summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJosh Faust <jfaust@suitabletech.com>2013-09-09 21:33:25 -0600
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-10-20 14:23:25 +0200
commit929d6d6b9b31967f13bcd51a421678edcb06d184 (patch)
tree4855a458c2f988d80b82e3729c211d1d0eab8b38 /src/gui
parentae89aa330fd1628e0780bfbdf7ceb772412399a6 (diff)
Fix ShortcutOverride for QtQuick on OSX
tryShortcutOverride on OSX gets called via QWindowSystemInterface::tryHandleShortcutEvent. This change fixes that to use the QWindow's focus object. Task-number: QTBUG-32928 Change-Id: I51beb774e1fb91e0d8e2c12d087176d917357311 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index d03a3f7be8..bd95a8614f 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -201,9 +201,13 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp,
#ifndef QT_NO_SHORTCUT
QGuiApplicationPrivate::modifier_buttons = mods;
+ QObject *focus = w->focusObject();
+ if (!focus)
+ focus = w;
+
QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
qevent.setTimestamp(timestamp);
- return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(w, &qevent);
+ return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, &qevent);
#else
Q_UNUSED(w)
Q_UNUSED(timestamp)
@@ -231,9 +235,13 @@ bool QWindowSystemInterface::tryHandleExtendedShortcutEvent(QWindow *w, ulong ti
#ifndef QT_NO_SHORTCUT
QGuiApplicationPrivate::modifier_buttons = mods;
+ QObject *focus = w->focusObject();
+ if (!focus)
+ focus = w;
+
QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
qevent.setTimestamp(timestamp);
- return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(w, &qevent);
+ return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, &qevent);
#else
Q_UNUSED(w)
Q_UNUSED(timestamp)