From 45abf54a611ae6c5dbd997d0ad5ab0a943b90f5a Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 9 Jun 2023 09:30:41 +0200 Subject: [PATCH] Handle Qt deprecation warning for shortcut setup Change-Id: If13b353111611bd2419ec17d7795836da2ec00fe Reviewed-by: Aleksei German --- src/plugins/insight/insightwidget.cpp | 2 +- .../assetslibrary/assetslibrarywidget.cpp | 2 +- .../contentlibrary/contentlibrarywidget.cpp | 2 +- .../materialeditor/materialeditorview.cpp | 2 +- .../propertyeditor/propertyeditorview.cpp | 4 ++-- .../components/richtexteditor/richtexteditor.cpp | 16 ++++++++-------- .../stateseditor/stateseditorwidget.cpp | 2 +- .../stateseditornew/stateseditorwidget.cpp | 2 +- .../textureeditor/textureeditorview.cpp | 2 +- src/plugins/vcsbase/submiteditorwidget.cpp | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/plugins/insight/insightwidget.cpp b/src/plugins/insight/insightwidget.cpp index aaf152bea31..03a46b03443 100644 --- a/src/plugins/insight/insightwidget.cpp +++ b/src/plugins/insight/insightwidget.cpp @@ -51,7 +51,7 @@ InsightWidget::InsightWidget(InsightView *insightView, InsightModel *insightMode engine()->addImportPath(propertyEditorResourcesPath() + "/imports"); engine()->addImportPath(qmlSourcesPath() + "/imports"); - m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11), this); + m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F11), this); connect(m_qmlSourceUpdateShortcut, &QShortcut::activated, this, diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp index 3b106d30b57..9a8a611c664 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp @@ -133,7 +133,7 @@ AssetsLibraryWidget::AssetsLibraryWidget(AsynchronousImageCache &asynchronousFon setStyleSheet(Theme::replaceCssColors( QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css")))); - m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F6), this); + m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F6), this); connect(m_qmlSourceUpdateShortcut, &QShortcut::activated, this, &AssetsLibraryWidget::reloadQmlSource); connect(this, &AssetsLibraryWidget::extFilesDrop, diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp index 0c7bf24030a..4c15cce8d7a 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp @@ -140,7 +140,7 @@ ContentLibraryWidget::ContentLibraryWidget() setStyleSheet(Theme::replaceCssColors( QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css")))); - m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11), this); + m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F11), this); connect(m_qmlSourceUpdateShortcut, &QShortcut::activated, this, &ContentLibraryWidget::reloadQmlSource); QmlDesignerPlugin::trackWidgetFocusTime(this, Constants::EVENT_CONTENTLIBRARY_TIME); diff --git a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp index 01d55d13db5..55c587f3cb4 100644 --- a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp +++ b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp @@ -59,7 +59,7 @@ MaterialEditorView::MaterialEditorView(ExternalDependenciesInterface &externalDe , m_stackedWidget(new QStackedWidget) , m_dynamicPropertiesModel(new DynamicPropertiesModel(true, this)) { - m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F7), m_stackedWidget); + m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F7), m_stackedWidget); connect(m_updateShortcut, &QShortcut::activated, this, &MaterialEditorView::reloadQml); m_ensureMatLibTimer.callOnTimeout([this] { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 8b1907f3d99..2cf47789e43 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -72,9 +72,9 @@ PropertyEditorView::PropertyEditorView(AsynchronousImageCache &imageCache, m_qmlDir = PropertyEditorQmlBackend::propertyEditorResourcesPath(); if (Utils::HostOsInfo::isMacHost()) - m_updateShortcut = new QShortcut(QKeySequence(Qt::ALT + Qt::Key_F3), m_stackedWidget); + m_updateShortcut = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_F3), m_stackedWidget); else - m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F3), m_stackedWidget); + m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F3), m_stackedWidget); connect(m_updateShortcut, &QShortcut::activated, this, &PropertyEditorView::reloadQml); m_stackedWidget->setStyleSheet(Theme::replaceCssColors( diff --git a/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp b/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp index 258c8a0a68f..9f22d5118a6 100644 --- a/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp +++ b/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp @@ -331,7 +331,7 @@ void RichTextEditor::setupTextActions() fmt.setFontWeight(checked ? QFont::Bold : QFont::Normal); mergeFormatOnWordOrSelection(fmt); }); - m_actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); + m_actionTextBold->setShortcut(Qt::CTRL | Qt::Key_B); QFont bold; bold.setBold(true); m_actionTextBold->setFont(bold); @@ -344,7 +344,7 @@ void RichTextEditor::setupTextActions() fmt.setFontItalic(checked); mergeFormatOnWordOrSelection(fmt); }); - m_actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); + m_actionTextItalic->setShortcut(Qt::CTRL | Qt::Key_I); QFont italic; italic.setItalic(true); m_actionTextItalic->setFont(italic); @@ -357,7 +357,7 @@ void RichTextEditor::setupTextActions() fmt.setFontUnderline(checked); mergeFormatOnWordOrSelection(fmt); }); - m_actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); + m_actionTextUnderline->setShortcut(Qt::CTRL | Qt::Key_U); QFont underline; underline.setUnderline(true); m_actionTextUnderline->setFont(underline); @@ -417,25 +417,25 @@ void RichTextEditor::setupAlignActions() { const QIcon leftIcon(getIcon(Theme::Icon::textAlignLeft)); m_actionAlignLeft = ui->toolBar->addAction(leftIcon, tr("&Left"), [this]() { ui->textEdit->setAlignment(Qt::AlignLeft | Qt::AlignAbsolute); }); - m_actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); + m_actionAlignLeft->setShortcut(Qt::CTRL | Qt::Key_L); m_actionAlignLeft->setCheckable(true); m_actionAlignLeft->setPriority(QAction::LowPriority); const QIcon centerIcon(getIcon(Theme::Icon::textAlignCenter)); m_actionAlignCenter = ui->toolBar->addAction(centerIcon, tr("C&enter"), [this]() { ui->textEdit->setAlignment(Qt::AlignHCenter); }); - m_actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); + m_actionAlignCenter->setShortcut(Qt::CTRL | Qt::Key_E); m_actionAlignCenter->setCheckable(true); m_actionAlignCenter->setPriority(QAction::LowPriority); const QIcon rightIcon(getIcon(Theme::Icon::textAlignRight)); m_actionAlignRight = ui->toolBar->addAction(rightIcon, tr("&Right"), [this]() { ui->textEdit->setAlignment(Qt::AlignRight | Qt::AlignAbsolute); }); - m_actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); + m_actionAlignRight->setShortcut(Qt::CTRL | Qt::Key_R); m_actionAlignRight->setCheckable(true); m_actionAlignRight->setPriority(QAction::LowPriority); const QIcon fillIcon(getIcon(Theme::Icon::textFullJustification)); m_actionAlignJustify = ui->toolBar->addAction(fillIcon, tr("&Justify"), [this]() { ui->textEdit->setAlignment(Qt::AlignJustify); }); - m_actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); + m_actionAlignJustify->setShortcut(Qt::CTRL | Qt::Key_J); m_actionAlignJustify->setCheckable(true); m_actionAlignJustify->setPriority(QAction::LowPriority); @@ -549,7 +549,7 @@ void RichTextEditor::setupTableActions() m_actionTableSettings = ui->toolBar->addAction(tableIcon, tr("&Table Settings"), [this](bool checked) { ui->tableBar->setVisible(checked); }); - m_actionTableSettings->setShortcut(Qt::CTRL + Qt::Key_T); + m_actionTableSettings->setShortcut(Qt::CTRL | Qt::Key_T); m_actionTableSettings->setCheckable(true); m_actionTableSettings->setPriority(QAction::LowPriority); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index 0501747d983..5c127727521 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -81,7 +81,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, engine()->addImportPath(qmlSourcesPath()); engine()->addImportPath(propertyEditorResourcesPath() + "/imports"); - m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F4), this); + m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F4), this); connect(m_qmlSourceUpdateShortcut, &QShortcut::activated, this, &StatesEditorWidget::reloadQmlSource); setResizeMode(QQuickWidget::SizeRootObjectToView); diff --git a/src/plugins/qmldesigner/components/stateseditornew/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditornew/stateseditorwidget.cpp index f3fd945ae6b..e07ba02ae01 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditornew/stateseditorwidget.cpp @@ -106,7 +106,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, engine()->addImportPath(propertyEditorResourcesPath() + "/imports"); engine()->addImportPath(qmlSourcesPath() + "/imports"); - m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F10), this); + m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F10), this); connect(m_qmlSourceUpdateShortcut, &QShortcut::activated, this, &StatesEditorWidget::reloadQmlSource); setObjectName(Constants::OBJECT_NAME_STATES_EDITOR); diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp b/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp index 5dd429f7600..221de40509f 100644 --- a/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp +++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp @@ -57,7 +57,7 @@ TextureEditorView::TextureEditorView(AsynchronousImageCache &imageCache, , m_stackedWidget(new QStackedWidget) , m_dynamicPropertiesModel(new DynamicPropertiesModel(true, this)) { - m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F12), m_stackedWidget); + m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F12), m_stackedWidget); connect(m_updateShortcut, &QShortcut::activated, this, &TextureEditorView::reloadQml); m_ensureMatLibTimer.callOnTimeout([this] { diff --git a/src/plugins/vcsbase/submiteditorwidget.cpp b/src/plugins/vcsbase/submiteditorwidget.cpp index 00b4200580a..38548d63f51 100644 --- a/src/plugins/vcsbase/submiteditorwidget.cpp +++ b/src/plugins/vcsbase/submiteditorwidget.cpp @@ -263,7 +263,7 @@ void SubmitEditorWidget::registerActions(QAction *editorUndoAction, QAction *edi d->m_submitButton = new QActionPushButton(submitAction); d->buttonLayout->addWidget(d->m_submitButton); if (!d->m_submitShortcut) - d->m_submitShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this); + d->m_submitShortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return), this); connect(d->m_submitShortcut, &QShortcut::activated, submitAction, [submitAction] { if (submitAction->isEnabled())