diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-02 13:18:34 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-02 12:48:43 +0000 |
commit | eb7bf1825ede649ae35ebec91ef430686ae2c70a (patch) | |
tree | b05b8f3f98dc2b35b2a34c0214d9f783a7a31df6 /src/quicktemplates2/qquickpopup.cpp | |
parent | 2069f1cae020113306f150309fb55de1c478ea59 (diff) |
Popup: don't steal focus on close from another opening popup
In the Gallery example, the settings dialog does not get focus (or to
be exact, loses it immediately), because the closing menu incorrectly
transfers focus back to the tool button that opened the menu.
Change-Id: I5328d8e825de9a977619688dc4478e6592db654f
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickpopup.cpp')
-rw-r--r-- | src/quicktemplates2/qquickpopup.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index e4e9cc11..e0a1f359 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -248,12 +248,14 @@ void QQuickPopupPrivate::finalizeExitTransition() popupItem->setParentItem(nullptr); popupItem->setVisible(false); - if (hadActiveFocusBeforeExitTransition) { - QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window); - if (applicationWindow) - applicationWindow->contentItem()->setFocus(true); - else if (window) - window->contentItem()->setFocus(true); + if (hadActiveFocusBeforeExitTransition && window) { + if (!qobject_cast<QQuickPopupItem *>(window->activeFocusItem())) { + QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window); + if (applicationWindow) + applicationWindow->contentItem()->setFocus(true); + else + window->contentItem()->setFocus(true); + } } visible = false; |