diff options
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 64 |
1 files changed, 7 insertions, 57 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f564475698..1efbca8490 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2165,10 +2165,12 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool // \a next). This is to ensure that we can tab in and out of compound widgets // without getting stuck in a tab-loop between parent and child. QWidget *focusProxy = test->d_func()->deepestFocusProxy(); - - if ((test->focusPolicy() & focus_flag) == focus_flag - && !(next && focusProxy && focusProxy->isAncestorOf(test)) - && !(!next && focusProxy && test->isAncestorOf(focusProxy)) + const bool canTakeFocus = ((focusProxy ? focusProxy->focusPolicy() : test->focusPolicy()) + & focus_flag) == focus_flag; + const bool composites = focusProxy ? (next ? focusProxy->isAncestorOf(test) + : test->isAncestorOf(focusProxy)) + : false; + if (canTakeFocus && !composites && test->isVisibleTo(toplevel) && test->isEnabled() && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { @@ -2907,59 +2909,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) return true; // Platform plugin ate the event } - if(e->spontaneous()) { - // Capture the current mouse and keyboard states. Doing so here is - // required in order to support Qt Test synthesized events. Real mouse - // and keyboard state updates from the platform plugin are managed by - // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event(); - // ### FIXME: Qt Test should not call qapp->notify(), but rather route - // the events through the proper QPA interface. This is required to - // properly generate all other events such as enter/leave etc. - switch (e->type()) { - case QEvent::MouseButtonPress: - { - QMouseEvent *me = static_cast<QMouseEvent*>(e); - QApplicationPrivate::modifier_buttons = me->modifiers(); - QApplicationPrivate::mouse_buttons |= me->button(); - break; - } - case QEvent::MouseButtonDblClick: - { - QMouseEvent *me = static_cast<QMouseEvent*>(e); - QApplicationPrivate::modifier_buttons = me->modifiers(); - QApplicationPrivate::mouse_buttons |= me->button(); - break; - } - case QEvent::MouseButtonRelease: - { - QMouseEvent *me = static_cast<QMouseEvent*>(e); - QApplicationPrivate::modifier_buttons = me->modifiers(); - QApplicationPrivate::mouse_buttons &= ~me->button(); - break; - } - case QEvent::KeyPress: - case QEvent::KeyRelease: - case QEvent::MouseMove: -#if QT_CONFIG(wheelevent) - case QEvent::Wheel: -#endif - case QEvent::TouchBegin: - case QEvent::TouchUpdate: - case QEvent::TouchEnd: -#if QT_CONFIG(tabletevent) - case QEvent::TabletMove: - case QEvent::TabletPress: - case QEvent::TabletRelease: -#endif - { - QInputEvent *ie = static_cast<QInputEvent*>(e); - QApplicationPrivate::modifier_buttons = ie->modifiers(); - break; - } - default: - break; - } - } + QGuiApplicationPrivate::captureGlobalModifierState(e); #ifndef QT_NO_GESTURES // walk through parents and check for gestures |