diff options
author | Tang Haixiang <tanghaixiang@uniontech.com> | 2021-08-06 10:28:28 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-13 00:54:00 +0000 |
commit | 189f362533648c5ebc2fc1137ef46c8cedc49044 (patch) | |
tree | c0c14b42028b00fdb3937b20d83b4f6f9668b98c /src/widgets | |
parent | 7d85fa29dc82e594486676fe87c86850729a9038 (diff) |
Close all popup windows when the screen is rotated
Changing the screen orientation will cause the menu position to be
displayed incorrectly. When the screen is rotated, the geometry of
the application changes. We can refer to the handling of the menu
on Android or IOS. Close the popup window when the screen
orientation changes.
Fixes: QTBUG-95607
Change-Id: I55e1cd6a8b89e375c6714a9163dfb1902d52f101
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit a7b1aaa98be60c739d11f1a7d30440a70c6ea77a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 25afb8b9b1..70ec46ed32 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2707,8 +2707,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) switch (e->type()) { case QEvent::ApplicationDeactivate: + case QEvent::OrientationChange: // Close all popups (triggers when switching applications // by pressing ALT-TAB on Windows, which is not receive as key event. + // triggers when the screen rotates.) closeAllPopups(); break; case QEvent::Wheel: // User input and window activation makes tooltips sleep |