summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-12 20:25:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-13 16:53:42 +0200
commit0e3ede3d176e062cec5680ca60978af2872b16a3 (patch)
treec1ac0f3844b70b3f80d7c767231538e51d71eb1f /src
parent0819c48e1bba1dd447f100d2f4a80ce5a3351ea8 (diff)
Fix ShortcutOverrid for Qt Quick
The tryShortcutOverride function needs to be called with the focus object. The same logic is in QGuiApplication::notify. Applications with QGuiApplication would therefore handle ShortcutOverride correctly where QApplication would not allow the override. ChangeLog: Fixed ShortcutOverrid for QtQuickControls. Now it is possible to assign a shortcut such as "b" and still type "b" in text inputs. Task-number: QTBUG-32928 Change-Id: I4f4ab82fd11f45174a4483a01bbbe8143dfe0724 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qapplication.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 777342d7ae..b918bdb9e9 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2858,7 +2858,14 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QKeyEvent* key = static_cast<QKeyEvent*>(e);
#ifndef QT_NO_SHORTCUT
// Try looking for a Shortcut before sending key events
- if (qApp->d_func()->shortcutMap.tryShortcutEvent(receiver, key))
+ QObject *shortcutReceiver = receiver;
+ if (!isWidget && isWindow) {
+ QWindow *w = qobject_cast<QWindow *>(receiver);
+ QObject *focus = w ? w->focusObject() : 0;
+ if (focus)
+ shortcutReceiver = focus;
+ }
+ if (qApp->d_func()->shortcutMap.tryShortcutEvent(shortcutReceiver, key))
return true;
#endif
qt_in_tab_key_event = (key->key() == Qt::Key_Backtab