summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2018-03-21 16:16:08 +0100
committerMichael BrĂ¼ning <michael.bruning@qt.io>2018-03-23 11:09:19 +0000
commitd5134640c1adc8060aea1fbc7500c063ca403887 (patch)
treecf050be71a870af562c4aa640a06fabe799ae2b4
parent5dcdd7c62ffc7fe398ac9d71d2f782df3ebd2e9b (diff)
Fix multiple shortcut events being delivered on macOS
Commit ef1d61a3516182b0a39330b5ac5988f92c82bc4f introduced a regression where multiple shortcut events where delivered on macOS. Instead of using tryShortcut (which triggers shortcut events) to check if the shortcut needs to be overridden, check if the shortcut map has an entry for the key seqeunce in question. Task-number: QTBUG-66207 Change-Id: I8d277e2ac39de8a1f2d2c43dc8486e042c4ea458 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
-rw-r--r--src/core/render_widget_host_view_qt.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 2d42dc11c..8bbf6d3d7 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -1008,8 +1008,11 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event)
auto acceptKeyOutOfInputField = [](QKeyEvent *keyEvent) -> bool {
#ifdef Q_OS_MACOS
- // Try triggering a registered shortcut
- if (QGuiApplicationPrivate::instance()->shortcutMap.tryShortcut(keyEvent))
+ // Check if a shortcut is registered for this key sequence.
+ QKeySequence sequence = QKeySequence (
+ (keyEvent->modifiers() | keyEvent->key()) &
+ ~(Qt::KeypadModifier | Qt::GroupSwitchModifier));
+ if (QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence))
return false;
// The following shortcuts are handled out of input field too but