[utilities/basket] src: Use operator| instead of operator+ for creating Qt::Modifiers
Pino Toscano <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit e5b05949e848adcc7a7ae1c99d0c04dc3754a060 by Pino Toscano.
Committed on 07/08/2026 at 10:37.
Pushed by pino into branch 'master'.
Use operator| instead of operator+ for creating Qt::Modifiers
Properly type a variable to ensure catching type mismatches.
M +5 -5 src/bnpview.cpp
M +5 -5 src/tagsedit.cpp
https://invent.kde.org/utilities/basket/-/commit/e5b05949e848adcc7a7ae1c99d0c04dc3754a060
diff --git a/src/bnpview.cpp b/src/bnpview.cpp
index c4d7712e..37997ec6 100644
--- a/src/bnpview.cpp
+++ b/src/bnpview.cpp
@@ -228,21 +228,21 @@ void BNPView::setupGlobalShortcuts()
// Ctrl+Shift+W only works when started standalone:
- int modifier = Qt::CTRL | Qt::ALT | Qt::SHIFT;
+ const Qt::Modifiers modifier = Qt::CTRL | Qt::ALT | Qt::SHIFT;
a = ac->addAction(QStringLiteral("global_paste"), Global::bnpView, &BNPView::globalPasteInCurrentBasket);
a->setText(i18n("Paste clipboard contents in current basket"));
a->setStatusTip(
i18n("Allows you to paste clipboard contents in the current basket "
"without having to open the main window."));
- KGlobalAccel::setGlobalShortcut(a, QKeySequence(modifier + Qt::Key_V));
+ KGlobalAccel::setGlobalShortcut(a, QKeySequence(modifier | Qt::Key_V));
a = ac->addAction(QStringLiteral("global_paste_selection"), Global::bnpView, &BNPView::pasteSelInCurrentBasket);
a->setText(i18n("Paste selection in current basket"));
a->setStatusTip(
i18n("Allows you to paste clipboard selection in the current basket "
"without having to open the main window."));
- KGlobalAccel::setGlobalShortcut(a, (QKeySequence(Qt::CTRL | Qt::ALT | Qt::SHIFT + Qt::Key_S)));
+ KGlobalAccel::setGlobalShortcut(a, (QKeySequence(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_S)));
a = ac->addAction(QStringLiteral("global_new_basket"), Global::bnpView, qOverload<>(&BNPView::askNewBasket));
a->setText(i18n("Create a new basket"));
@@ -268,7 +268,7 @@ void BNPView::setupGlobalShortcuts()
a->setStatusTip(
i18n("Add a text note to the current basket without having to open "
"the main window."));
- KGlobalAccel::setGlobalShortcut(a, (QKeySequence(modifier + Qt::Key_T)));
+ KGlobalAccel::setGlobalShortcut(a, (QKeySequence(modifier | Qt::Key_T)));
a = ac->addAction(QStringLiteral("global_note_add_image"), Global::bnpView, &BNPView::addNoteImage);
a->setText(i18n("Insert image note"));
@@ -431,7 +431,7 @@ void BNPView::setupActions()
a = ac->addAction(QStringLiteral("edit_invert_selection"), this, &BNPView::slotInvertSelection);
a->setText(i18n("&Invert Selection"));
- m_actionCollection->setDefaultShortcut(a, Qt::CTRL + Qt::Key_Asterisk);
+ m_actionCollection->setDefaultShortcut(a, Qt::CTRL | Qt::Key_Asterisk);
m_actInvertSelection = a;
m_actInvertSelection->setStatusTip(i18n("Inverts the current selection of notes"));
diff --git a/src/tagsedit.cpp b/src/tagsedit.cpp
index 1da2e6e6..1c7da027 100644
--- a/src/tagsedit.cpp
+++ b/src/tagsedit.cpp
@@ -673,23 +673,23 @@ TagsEditDialog::TagsEditDialog(QWidget *parent, State *stateToEdit, bool addNewT
// Some keyboard shortcuts: // Ctrl+arrows instead of Alt+arrows (same as Go menu in the main window) because Alt+Down is for combo boxes
auto *selectAbove = new QAction(this);
- selectAbove->setShortcut(Qt::CTRL + Qt::Key_Up);
+ selectAbove->setShortcut(Qt::CTRL | Qt::Key_Up);
connect(selectAbove, &QAction::triggered, this, &TagsEditDialog::selectUp);
auto *selectBelow = new QAction(this);
- selectBelow->setShortcut(Qt::CTRL + Qt::Key_Down);
+ selectBelow->setShortcut(Qt::CTRL | Qt::Key_Down);
connect(selectBelow, &QAction::triggered, this, &TagsEditDialog::selectDown);
auto *selectLeft = new QAction(this);
- selectLeft->setShortcut(Qt::CTRL + Qt::Key_Left);
+ selectLeft->setShortcut(Qt::CTRL | Qt::Key_Left);
connect(selectLeft, &QAction::triggered, this, &TagsEditDialog::selectLeft);
auto *selectRight = new QAction(this);
- selectRight->setShortcut(Qt::CTRL + Qt::Key_Right);
+ selectRight->setShortcut(Qt::CTRL | Qt::Key_Right);
connect(selectRight, &QAction::triggered, this, &TagsEditDialog::selectRight);
auto *moveAbove = new QAction(this);
- moveAbove->setShortcut(Qt::CTRL + Qt::Key_Up);
+ moveAbove->setShortcut(Qt::CTRL | Qt::Key_Up);
connect(moveAbove, &QAction::triggered, this, &TagsEditDialog::moveUp);
auto *moveBelow = new QAction(this);