diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qkeymapper.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qkeymapper_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qshortcutmap.cpp | 5 |
3 files changed, 8 insertions, 11 deletions
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index bd7dbd90e9..76ec7eba0d 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -35,21 +35,17 @@ QKeyMapper::~QKeyMapper() { } -QList<int> QKeyMapper::possibleKeys(const QKeyEvent *e) +QList<QKeyCombination> QKeyMapper::possibleKeys(const QKeyEvent *e) { - QList<int> result; - const auto *platformIntegration = QGuiApplicationPrivate::platformIntegration(); const auto *platformKeyMapper = platformIntegration->keyMapper(); - const auto keyCombinations = platformKeyMapper->possibleKeyCombinations(e); - for (auto keyCombination : keyCombinations) - result << keyCombination.toCombined(); + QList<QKeyCombination> result = platformKeyMapper->possibleKeyCombinations(e); if (result.isEmpty()) { if (e->key() && (e->key() != Qt::Key_unknown)) - result << e->keyCombination().toCombined(); + result << e->keyCombination(); else if (!e->text().isEmpty()) - result << int(e->text().at(0).unicode() + (int)e->modifiers()); + result << (Qt::Key(e->text().at(0).unicode()) | e->modifiers()); } return result; diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 5c6f89ab82..1a6a9a608f 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -33,7 +33,7 @@ public: ~QKeyMapper(); static QKeyMapper *instance(); - static QList<int> possibleKeys(const QKeyEvent *e); + static QList<QKeyCombination> possibleKeys(const QKeyEvent *e); QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QKeyMapper) diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index a2acf467e1..800e703ac2 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -493,7 +493,7 @@ void QShortcutMap::clearSequence(QList<QKeySequence> &ksl) void QShortcutMap::createNewSequences(QKeyEvent *e, QList<QKeySequence> &ksl, int ignoredModifiers) { Q_D(QShortcutMap); - QList<int> possibleKeys = QKeyMapper::possibleKeys(e); + QList<QKeyCombination> possibleKeys = QKeyMapper::possibleKeys(e); qCDebug(lcShortcutMap) << "Creating new sequences for" << e << "with ignoredModifiers=" << Qt::KeyboardModifiers(ignoredModifiers); int pkTotal = possibleKeys.size(); @@ -522,7 +522,8 @@ void QShortcutMap::createNewSequences(QKeyEvent *e, QList<QKeySequence> &ksl, in curKsl.setKey(QKeyCombination::fromCombined(0), 2); curKsl.setKey(QKeyCombination::fromCombined(0), 3); } - curKsl.setKey(QKeyCombination::fromCombined(possibleKeys.at(pkNum) & ~ignoredModifiers), index); + const int key = possibleKeys.at(pkNum).toCombined(); + curKsl.setKey(QKeyCombination::fromCombined(key & ~ignoredModifiers), index); } } } |