summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qkeysequenceedit.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-09-21 00:53:59 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-10-11 01:48:13 +0200
commitf8f5e2c122eeb1dc4d1fc1984e066bc6d9bd07ec (patch)
tree25ea5c3dd60d2f876a92cd4cd74367da41e18c51 /src/widgets/widgets/qkeysequenceedit.cpp
parent8af35d27e8f02bbb99aef4ac495ed406e50e3cca (diff)
Make QKeyMapper::possibleKeys() return list of QKeyCombinations
Having the explicit type instead of the opaque int makes it clearer what we're dealing with. Task-number: QTBUG-116873 Change-Id: I19e42ed329e15ab25a958602ecfb99b1c9d52a99 Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/widgets/widgets/qkeysequenceedit.cpp')
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp
index 0b39d5c1c6..65ed7a465a 100644
--- a/src/widgets/widgets/qkeysequenceedit.cpp
+++ b/src/widgets/widgets/qkeysequenceedit.cpp
@@ -344,22 +344,23 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
return;
if (e->modifiers() & Qt::ShiftModifier) {
- const QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
+ const QList<QKeyCombination> possibleKeys = QKeyMapper::possibleKeys(e);
int pkTotal = possibleKeys.size();
if (!pkTotal)
return;
bool found = false;
for (int i = 0; i < possibleKeys.size(); ++i) {
- if (possibleKeys.at(i) - nextKey == int(e->modifiers())
- || (possibleKeys.at(i) == nextKey && e->modifiers() == Qt::ShiftModifier)) {
- nextKey = possibleKeys.at(i);
+ const int key = possibleKeys.at(i).toCombined();
+ if (key - nextKey == int(e->modifiers())
+ || (key == nextKey && e->modifiers() == Qt::ShiftModifier)) {
+ nextKey = key;
found = true;
break;
}
}
// Use as fallback
if (!found)
- nextKey = possibleKeys.first();
+ nextKey = possibleKeys.first().toCombined();
} else {
nextKey |= d->translateModifiers(e->modifiers(), e->text());
}