summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-04 21:58:18 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-09-07 10:44:40 +0000
commit61c794846f3db82a10e5505397adb1b19bd21076 (patch)
tree57a6591fc6c0e08a16ea3f3c0ad081118774d343
parent2d557b1c5c4d2da8d307519835a0b97287891a9c (diff)
Use operator| to compose key sequences
In preparation for deprecating operator+. It's deprecated in C++20. Insert casts as necessary. Drive-by, prepare for deprecation of operator+ for building key sequences. Initial-patch-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Change-Id: Iaae4e35a56aa1c2365bc25af2582cf820de38d5e Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit ae8239a53ea9c512d60f54903c741aab33a6b439) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/assistant/assistant/mainwindow.cpp8
-rw-r--r--src/designer/src/components/formeditor/formwindowmanager.cpp20
-rw-r--r--src/designer/src/designer/qdesigner_actions.cpp2
-rw-r--r--src/designer/src/designer/qdesigner_toolwindow.cpp2
-rw-r--r--src/linguist/linguist/phraseview.h3
5 files changed, 18 insertions, 17 deletions
diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp
index 5b0163fb1..7c0b5de7f 100644
--- a/src/assistant/assistant/mainwindow.cpp
+++ b/src/assistant/assistant/mainwindow.cpp
@@ -609,12 +609,12 @@ void MainWindow::setupActions()
tmp = menu->addAction(tr("Next Page"),
openPages, &OpenPagesManager::nextPage);
tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Right"))
- << QKeySequence(Qt::CTRL + Qt::Key_PageDown));
+ << QKeySequence(Qt::CTRL | Qt::Key_PageDown));
tmp = menu->addAction(tr("Previous Page"),
openPages, &OpenPagesManager::previousPage);
tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Left"))
- << QKeySequence(Qt::CTRL + Qt::Key_PageUp));
+ << QKeySequence(Qt::CTRL | Qt::Key_PageUp));
const Qt::Modifier modifier =
#ifdef Q_OS_MAC
@@ -623,10 +623,10 @@ void MainWindow::setupActions()
Qt::CTRL;
#endif
- QShortcut *sct = new QShortcut(QKeySequence(modifier + Qt::Key_Tab), this);
+ QShortcut *sct = new QShortcut(QKeySequence(modifier | Qt::Key_Tab), this);
connect(sct, &QShortcut::activated,
openPages, &OpenPagesManager::nextPageWithSwitcher);
- sct = new QShortcut(QKeySequence(modifier + Qt::SHIFT + Qt::Key_Tab), this);
+ sct = new QShortcut(QKeySequence(modifier | Qt::SHIFT | Qt::Key_Tab), this);
connect(sct, &QShortcut::activated,
openPages, &OpenPagesManager::previousPageWithSwitcher);
diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp
index 692b20c54..d485a133c 100644
--- a/src/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/src/designer/src/components/formeditor/formwindowmanager.cpp
@@ -409,7 +409,7 @@ void FormWindowManager::setupActions()
m_actionRaise = new QAction(createIconSet(QStringLiteral("editraise.png")), tr("Bring to &Front"), this);
m_actionRaise->setObjectName(QStringLiteral("__qt_raise_action"));
- m_actionRaise->setShortcut(Qt::CTRL + Qt::Key_L);
+ m_actionRaise->setShortcut(Qt::CTRL | Qt::Key_L);
m_actionRaise->setStatusTip(tr("Raises the selected widgets"));
m_actionRaise->setWhatsThis(tr("Raises the selected widgets"));
connect(m_actionRaise, &QAction::triggered, this, &FormWindowManager::slotActionRaiseActivated);
@@ -417,7 +417,7 @@ void FormWindowManager::setupActions()
m_actionLower = new QAction(createIconSet(QStringLiteral("editlower.png")), tr("Send to &Back"), this);
m_actionLower->setObjectName(QStringLiteral("__qt_lower_action"));
- m_actionLower->setShortcut(Qt::CTRL + Qt::Key_K);
+ m_actionLower->setShortcut(Qt::CTRL | Qt::Key_K);
m_actionLower->setStatusTip(tr("Lowers the selected widgets"));
m_actionLower->setWhatsThis(tr("Lowers the selected widgets"));
connect(m_actionLower, &QAction::triggered, this, &FormWindowManager::slotActionLowerActivated);
@@ -425,7 +425,7 @@ void FormWindowManager::setupActions()
m_actionAdjustSize = new QAction(createIconSet(QStringLiteral("adjustsize.png")), tr("Adjust &Size"), this);
m_actionAdjustSize->setObjectName(QStringLiteral("__qt_adjust_size_action"));
- m_actionAdjustSize->setShortcut(Qt::CTRL + Qt::Key_J);
+ m_actionAdjustSize->setShortcut(Qt::CTRL | Qt::Key_J);
m_actionAdjustSize->setStatusTip(tr("Adjusts the size of the selected widget"));
m_actionAdjustSize->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Adjust Size")));
connect(m_actionAdjustSize, &QAction::triggered, this, &FormWindowManager::slotActionAdjustSizeActivated);
@@ -434,7 +434,7 @@ void FormWindowManager::setupActions()
m_actionHorizontalLayout = new QAction(createIconSet(QStringLiteral("edithlayout.png")), tr("Lay Out &Horizontally"), this);
m_actionHorizontalLayout->setObjectName(QStringLiteral("__qt_horizontal_layout_action"));
- m_actionHorizontalLayout->setShortcut(Qt::CTRL + Qt::Key_1);
+ m_actionHorizontalLayout->setShortcut(Qt::CTRL | Qt::Key_1);
m_actionHorizontalLayout->setStatusTip(tr("Lays out the selected widgets horizontally"));
m_actionHorizontalLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Horizontally")));
m_actionHorizontalLayout->setData(LayoutInfo::HBox);
@@ -443,7 +443,7 @@ void FormWindowManager::setupActions()
m_actionVerticalLayout = new QAction(createIconSet(QStringLiteral("editvlayout.png")), tr("Lay Out &Vertically"), this);
m_actionVerticalLayout->setObjectName(QStringLiteral("__qt_vertical_layout_action"));
- m_actionVerticalLayout->setShortcut(Qt::CTRL + Qt::Key_2);
+ m_actionVerticalLayout->setShortcut(Qt::CTRL | Qt::Key_2);
m_actionVerticalLayout->setStatusTip(tr("Lays out the selected widgets vertically"));
m_actionVerticalLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Vertically")));
m_actionVerticalLayout->setData(LayoutInfo::VBox);
@@ -453,7 +453,7 @@ void FormWindowManager::setupActions()
QIcon formIcon = QIcon::fromTheme(QStringLiteral("designer-form-layout"), createIconSet(QStringLiteral("editform.png")));
m_actionFormLayout = new QAction(formIcon, tr("Lay Out in a &Form Layout"), this);
m_actionFormLayout->setObjectName(QStringLiteral("__qt_form_layout_action"));
- m_actionFormLayout->setShortcut(Qt::CTRL + Qt::Key_6);
+ m_actionFormLayout->setShortcut(Qt::CTRL | Qt::Key_6);
m_actionFormLayout->setStatusTip(tr("Lays out the selected widgets in a form layout"));
m_actionFormLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out in a Form")));
m_actionFormLayout->setData(LayoutInfo::Form);
@@ -462,7 +462,7 @@ void FormWindowManager::setupActions()
m_actionGridLayout = new QAction(createIconSet(QStringLiteral("editgrid.png")), tr("Lay Out in a &Grid"), this);
m_actionGridLayout->setObjectName(QStringLiteral("__qt_grid_layout_action"));
- m_actionGridLayout->setShortcut(Qt::CTRL + Qt::Key_5);
+ m_actionGridLayout->setShortcut(Qt::CTRL | Qt::Key_5);
m_actionGridLayout->setStatusTip(tr("Lays out the selected widgets in a grid"));
m_actionGridLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out in a Grid")));
m_actionGridLayout->setData(LayoutInfo::Grid);
@@ -472,7 +472,7 @@ void FormWindowManager::setupActions()
m_actionSplitHorizontal = new QAction(createIconSet(QStringLiteral("edithlayoutsplit.png")),
tr("Lay Out Horizontally in S&plitter"), this);
m_actionSplitHorizontal->setObjectName(QStringLiteral("__qt_split_horizontal_action"));
- m_actionSplitHorizontal->setShortcut(Qt::CTRL + Qt::Key_3);
+ m_actionSplitHorizontal->setShortcut(Qt::CTRL | Qt::Key_3);
m_actionSplitHorizontal->setStatusTip(tr("Lays out the selected widgets horizontally in a splitter"));
m_actionSplitHorizontal->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Horizontally in Splitter")));
m_actionSplitHorizontal->setData(LayoutInfo::HSplitter);
@@ -482,7 +482,7 @@ void FormWindowManager::setupActions()
m_actionSplitVertical = new QAction(createIconSet(QStringLiteral("editvlayoutsplit.png")),
tr("Lay Out Vertically in Sp&litter"), this);
m_actionSplitVertical->setObjectName(QStringLiteral("__qt_split_vertical_action"));
- m_actionSplitVertical->setShortcut(Qt::CTRL + Qt::Key_4);
+ m_actionSplitVertical->setShortcut(Qt::CTRL | Qt::Key_4);
m_actionSplitVertical->setStatusTip(tr("Lays out the selected widgets vertically in a splitter"));
m_actionSplitVertical->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Vertically in Splitter")));
connect(m_actionSplitVertical, &QAction::triggered, this, &FormWindowManager::createLayout);
@@ -492,7 +492,7 @@ void FormWindowManager::setupActions()
m_actionBreakLayout = new QAction(createIconSet(QStringLiteral("editbreaklayout.png")), tr("&Break Layout"), this);
m_actionBreakLayout->setObjectName(QStringLiteral("__qt_break_layout_action"));
- m_actionBreakLayout->setShortcut(Qt::CTRL + Qt::Key_0);
+ m_actionBreakLayout->setShortcut(Qt::CTRL | Qt::Key_0);
m_actionBreakLayout->setStatusTip(tr("Breaks the selected layout"));
m_actionBreakLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Break Layout")));
connect(m_actionBreakLayout, &QAction::triggered, this, &FormWindowManager::slotActionBreakLayoutActivated);
diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp
index ff11079b5..bb49cb8cb 100644
--- a/src/designer/src/designer/qdesigner_actions.cpp
+++ b/src/designer/src/designer/qdesigner_actions.cpp
@@ -441,7 +441,7 @@ QActionGroup *QDesignerActions::createHelpActions()
QAction *mainHelpAction = new QAction(tr("Qt Designer &Help"), this);
mainHelpAction->setObjectName(QStringLiteral("__qt_designer_help_action"));
connect(mainHelpAction, &QAction::triggered, this, &QDesignerActions::showDesignerHelp);
- mainHelpAction->setShortcut(Qt::CTRL + Qt::Key_Question);
+ mainHelpAction->setShortcut(Qt::CTRL | Qt::Key_Question);
helpActions->addAction(mainHelpAction);
helpActions->addAction(createSeparator(this));
diff --git a/src/designer/src/designer/qdesigner_toolwindow.cpp b/src/designer/src/designer/qdesigner_toolwindow.cpp
index e71edcb0c..f9e913671 100644
--- a/src/designer/src/designer/qdesigner_toolwindow.cpp
+++ b/src/designer/src/designer/qdesigner_toolwindow.cpp
@@ -171,7 +171,7 @@ PropertyEditorToolWindow::PropertyEditorToolWindow(QDesignerWorkbench *workbench
QStringLiteral("__qt_property_editor_action"),
Qt::RightDockWidgetArea)
{
- action()->setShortcut(Qt::CTRL + Qt::Key_I);
+ action()->setShortcut(Qt::CTRL | Qt::Key_I);
}
diff --git a/src/linguist/linguist/phraseview.h b/src/linguist/linguist/phraseview.h
index 708105db3..a49327c2c 100644
--- a/src/linguist/linguist/phraseview.h
+++ b/src/linguist/linguist/phraseview.h
@@ -48,7 +48,8 @@ public:
GuessShortcut(int nkey, QWidget *parent, const char *member)
: QShortcut(parent), nrkey(nkey)
{
- setKey(Qt::CTRL + (Qt::Key_1 + nrkey));
+ const auto key = static_cast<Qt::Key>(int(Qt::Key_1) + nrkey);
+ setKey(Qt::CTRL | key);
connect(this, SIGNAL(activated()), this, SLOT(keyActivated()));
connect(this, SIGNAL(activated(int)), parent, member);
}