diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-08-05 21:23:45 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-08-19 13:46:35 +0200 |
commit | 1a5a0a591c35dcf498a232a802087683f2244ecb (patch) | |
tree | 266f381faef196310faac61e229293dae38443df /src/quicktemplates2/qquickpopup.cpp | |
parent | 64230bf97c18297f45bd5d7ccf99b510c8a612bd (diff) |
Prevent against re-entering prepareExitTransition after a focus change
When a popup is hidden, then it will trigger a prepareExitTransition
which can cause the active focus to be lost. If the popup's visibility
is tied to that fact then it can retrigger the transition which means
the active focus does not go back to where it should.
Therefore, we check if hadActiveFocusBeforeExitTransition is false before
going through that process as then it will only be called the first time
the popup is hidden.
Pick-to: 5.15
Fixes: QTBUG-85884
Change-Id: I68054aeb48447617b4235ce6467514a17f1073ba
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/quicktemplates2/qquickpopup.cpp')
-rw-r--r-- | src/quicktemplates2/qquickpopup.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 57b93036..d5a0ccf4 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -451,7 +451,7 @@ bool QQuickPopupPrivate::prepareExitTransition() if (transitionState == ExitTransition && transitionManager.isRunning()) return false; - if (transitionState != ExitTransition) { + if (transitionState != ExitTransition && !hadActiveFocusBeforeExitTransition) { // The setFocus(false) call below removes any active focus before we're // able to check it in finalizeExitTransition. hadActiveFocusBeforeExitTransition = popupItem->hasActiveFocus(); |