aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2019-11-26 14:49:20 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2019-11-26 14:49:20 +0200
commit0d2fc12b65028b4f04bdace3991448813130ab48 (patch)
tree3666621eced42e3a2f663085a6fd969585edada9 /src
parent546539562f2aff985e78f3c2426cb711a865ad65 (diff)
parentf9877da406ad96d82becb15b6eef9b723b8807e3 (diff)
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickpopup.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index f272c5cf..45cbecf4 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -485,11 +485,18 @@ void QQuickPopupPrivate::finalizeExitTransition()
if (hadActiveFocusBeforeExitTransition && window) {
// restore focus to the next popup in chain, or to the window content if there are no other popups open
- QQuickPopup *popup = nullptr;
- if (QQuickOverlay *overlay = QQuickOverlay::overlay(window))
- popup = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups().value(0);
- if (popup && popup->hasFocus()) {
- popup->forceActiveFocus();
+ QQuickPopup *nextFocusPopup = nullptr;
+ if (QQuickOverlay *overlay = QQuickOverlay::overlay(window)) {
+ const auto stackingOrderPopups = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups();
+ for (auto popup : stackingOrderPopups) {
+ if (QQuickPopupPrivate::get(popup)->transitionState != ExitTransition) {
+ nextFocusPopup = popup;
+ break;
+ }
+ }
+ }
+ if (nextFocusPopup && nextFocusPopup->hasFocus()) {
+ nextFocusPopup->forceActiveFocus();
} else {
QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
if (applicationWindow)