Handle Qt deprecation warning for shortcut setup

Change-Id: If13b353111611bd2419ec17d7795836da2ec00fe
Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
hjk
2023-06-09 09:30:41 +02:00
parent daad58175b
commit 45abf54a61
10 changed files with 18 additions and 18 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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);

View File

@@ -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] {

View File

@@ -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(

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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] {

View File

@@ -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())