diff options
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3fabeb1445..adccee9426 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2842,6 +2842,37 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; } + 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 + if (qApp->d_func()->shortcutMap.tryShortcutEvent(receiver, 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); + + } + default: + break; + } + bool res = false; if (!receiver->isWidgetType()) { res = d->notify_helper(receiver, e); @@ -2855,25 +2886,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) #ifndef QT_NO_GRAPHICSVIEW isGraphicsWidget = !isWidget && qobject_cast<QGraphicsWidget *>(receiver); #endif - if (!isWidget && !isGraphicsWidget) { - res = d->notify_helper(receiver, e); - break; - } - QKeyEvent* key = static_cast<QKeyEvent*>(e); - if (key->type()==QEvent::KeyPress) { -#ifndef QT_NO_SHORTCUT - // Try looking for a Shortcut before sending key events - if ((res = qApp->d_func()->shortcutMap.tryShortcutEvent(receiver, key))) - return res; -#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); - } bool def = key->isAccepted(); QPointer<QObject> pr = receiver; while (receiver) { |