diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp index b68ed9a4f7f..2b04d6b2ce6 100644 --- a/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp +++ b/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp @@ -1008,8 +1008,8 @@ void ObjectItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) menu.addSeparator(); menu.addAction(new ContextMenuAction(tr("Remove"), "remove", QKeySequence(QKeySequence::Delete), &menu)); - menu.addAction(new ContextMenuAction(tr("Delete"), "delete", - QKeySequence(Qt::CTRL + Qt::Key_D), &menu)); + menu.addAction( + new ContextMenuAction(tr("Delete"), "delete", QKeySequence(Qt::CTRL | Qt::Key_D), &menu)); //menu.addAction(new ContextMenuAction(tr("Select in Model Tree"), "selectInModelTree", &menu)); QMenu alignMenu; alignMenu.setTitle(tr("Align Objects")); diff --git a/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp b/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp index 5ad40944f67..4a3d2472a56 100644 --- a/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp +++ b/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp @@ -260,8 +260,10 @@ void ModelTreeView::contextMenuEvent(QContextMenuEvent *event) if (melement->owner()) { if (addSeparator) menu.addSeparator(); - menu.addAction(new ContextMenuAction(tr("Delete"), "delete", - QKeySequence(Qt::CTRL + Qt::Key_D), &menu)); + menu.addAction(new ContextMenuAction(tr("Delete"), + "delete", + QKeySequence(Qt::CTRL | Qt::Key_D), + &menu)); } QAction *selectedAction = menu.exec(event->globalPos()); if (selectedAction) { diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index cf88311efe0..46c4e6699dc 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -117,12 +117,18 @@ static QKeySequence keySequenceFromEditString(const QString &editString) return QKeySequence::fromString(text, QKeySequence::PortableText); } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +using KeyCombination = int; +#else +using KeyCombination = QKeyCombination; +#endif + static bool keySequenceIsValid(const QKeySequence &sequence) { if (sequence.isEmpty()) return false; for (int i = 0; i < sequence.count(); ++i) { - if (sequence[i] == Qt::Key_unknown) + if (sequence[i] == KeyCombination(Qt::Key_unknown)) return false; } return true; diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index c8c54f6a53f..7300735cc38 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -175,7 +175,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : 28, 28, textColorNormal); m_zoomInAction = new QAction(zoomInIcon, tr("Zoom in"), this); - m_zoomInAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Plus)); + m_zoomInAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Plus)); connect(m_zoomInAction.data(), &QAction::triggered, this, [this] { if (!m_formEditorView) return; @@ -187,7 +187,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : m_toolBox->addRightSideAction(m_zoomInAction.data()); m_zoomOutAction = new QAction(zoomOutIcon, tr("Zoom out"), this); - m_zoomOutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Minus)); + m_zoomOutAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Minus)); connect(m_zoomOutAction.data(), &QAction::triggered, this, [this] { if (!m_formEditorView) return; @@ -206,7 +206,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : m_toolBox->addRightSideAction(m_zoomAction.data()); m_zoomAllAction = new QAction(zoomAllIcon, tr("Zoom screen to fit all content"), this); - m_zoomAllAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_0)); + m_zoomAllAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_0)); connect(m_zoomAllAction.data(), &QAction::triggered, this, [this] { if (!m_formEditorView) return; @@ -218,7 +218,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : m_toolBox->addRightSideAction(m_zoomAllAction.data()); m_zoomSelectionAction = new QAction(zoomSelectionIcon, tr("Zoom screen to fit current selection"), this); - m_zoomSelectionAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_I)); + m_zoomSelectionAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); connect(m_zoomSelectionAction.data(), &QAction::triggered, this, [this] { if (!m_formEditorView) return; diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp index d47505d70e7..a1e2cb6fc16 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp @@ -185,11 +185,11 @@ bool TextEditorWidget::eventFilter( QObject *, QEvent *event) static std::vector overrideSequences = { QKeySequence::SelectAll, QKeySequence::Cut, QKeySequence::Copy, QKeySequence::Delete, QKeySequence::Paste, QKeySequence::Undo, - QKeySequence::Redo, QKeySequence(Qt::CTRL + Qt::ALT), - QKeySequence(Qt::Key_Left + Qt::CTRL), - QKeySequence(Qt::Key_Right + Qt::CTRL), - QKeySequence(Qt::Key_Up + Qt::CTRL), - QKeySequence(Qt::Key_Down + Qt::CTRL) + QKeySequence::Redo, QKeySequence(Qt::CTRL | Qt::ALT), + QKeySequence(Qt::Key_Left | Qt::CTRL), + QKeySequence(Qt::Key_Right | Qt::CTRL), + QKeySequence(Qt::Key_Up | Qt::CTRL), + QKeySequence(Qt::Key_Down | Qt::CTRL) }; if (event->type() == QEvent::ShortcutOverride) { auto keyEvent = static_cast(event); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 9e82914fb81..7414a1a972b 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -191,8 +191,8 @@ QmlJSEditorPluginPrivate::QmlJSEditorPluginPrivate() QAction *showQuickToolbar = new QAction(QmlJSEditorPlugin::tr("Show Qt Quick Toolbar"), this); cmd = ActionManager::registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context); - cmd->setDefaultKeySequence(useMacShortcuts ? QKeySequence(Qt::META + Qt::ALT + Qt::Key_Space) - : QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space)); + cmd->setDefaultKeySequence(useMacShortcuts ? QKeySequence(Qt::META | Qt::ALT | Qt::Key_Space) + : QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Space)); connect(showQuickToolbar, &QAction::triggered, this, &QmlJSEditorPluginPrivate::showContextPane); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd);