summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-06-12 23:42:59 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-10-30 11:40:18 +0100
commitd7ca800a87a2291c94c6580f0cfe068bb2280caf (patch)
tree8eb635ee119d6b6e893b98df3c3cc04a90da4ba1 /src/widgets/kernel
parentf6f797a6c3b794d14c312855bacc8b5b89ea6127 (diff)
Clean up ShortcutOverride handling
Instead of sending the event from random places, send it from QWindowSystemInterface. This allows to send override events on OS X to menus before doing other key processing and reduces the number of ShortcutOverride events on all platforms to exactly one per key press event. Additional test by Friedemann Kleint. Task-number: QTBUG-38986 Change-Id: I6981bb776aba586ebc7c3daa5fd7a0d84c25bc3e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp42
1 files changed, 9 insertions, 33 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index c913d83213..6df1d735a1 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3126,39 +3126,15 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
switch (e->type()) {
- case QEvent::KeyPress:
- {
- bool isWidget = receiver->isWidgetType();
- bool isWindow = receiver->isWindowType();
- bool isGraphicsWidget = false;
-#ifndef QT_NO_GRAPHICSVIEW
- isGraphicsWidget = !isWidget && !isWindow && qobject_cast<QGraphicsWidget *>(receiver);
-#endif
- if (!isWidget && !isGraphicsWidget && !isWindow) {
- return d->notify_helper(receiver, e);
- }
-
- QKeyEvent* key = static_cast<QKeyEvent*>(e);
-#ifndef QT_NO_SHORTCUT
- // Try looking for a Shortcut before sending key events
- 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
- || key->key() == Qt::Key_Tab
- || key->key() == Qt::Key_Left
- || key->key() == Qt::Key_Up
- || key->key() == Qt::Key_Right
- || key->key() == Qt::Key_Down);
-
- }
+ case QEvent::KeyPress: {
+ int key = static_cast<QKeyEvent*>(e)->key();
+ qt_in_tab_key_event = (key == Qt::Key_Backtab
+ || key == Qt::Key_Tab
+ || key == Qt::Key_Left
+ || key == Qt::Key_Up
+ || key == Qt::Key_Right
+ || key == Qt::Key_Down);
+ }
default:
break;
}