summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-09-04 10:43:21 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-09-05 02:06:54 +0200
commite6c9ef72a9d39a450909aa49030bcae1724af23d (patch)
treeeff304af351afe7f8556f285324e8d28821ecf92 /src/plugins
parent0f39cfae93ab20e6e190bc02225265d6186149d3 (diff)
QWindowsKeyMapper: fix mixed math between int and enum/flags
Either do it between ints, or cast to the right types before doing it. This should enable removing operator+ and - between int and QFlags. Change-Id: I30ecc03566cff8ce880b048ba3a9d7d50f3c8509 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index bca23cb33e..c6569d3983 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -907,7 +907,7 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
// the keys are not passed to the active media player.
# if QT_CONFIG(shortcut)
- const QKeySequence sequence(Qt::Modifier(state) + qtKey);
+ const QKeySequence sequence(Qt::Modifier(state) | Qt::Key(qtKey));
return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence);
# else
return false;
@@ -1379,14 +1379,14 @@ QList<int> QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const
result << int(Qt::Key_Enter + keyMods);
return result;
}
- result << int(baseKey + keyMods); // The base key is _always_ valid, of course
+ result << int(baseKey) + int(keyMods); // The base key is _always_ valid, of course
for (size_t i = 1; i < NumMods; ++i) {
Qt::KeyboardModifiers neededMods = ModsTbl[i];
quint32 key = kbItem.qtKey[i];
if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) {
const Qt::KeyboardModifiers missingMods = keyMods & ~neededMods;
- const int matchedKey = int(key) + missingMods;
+ const int matchedKey = int(key) + int(missingMods);
const auto it =
std::find_if(result.begin(), result.end(),
[key] (int k) { return (k & ~Qt::KeyboardModifierMask) == key; });