summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Roquetto <rafaelr@blackmagicdesign.com>2018-10-01 09:16:28 +1000
committerRafael Roquetto <rafael@roquetto.com>2018-10-28 22:52:00 +0000
commitd02fed67814a3cb8f28a4f0ec61e075858fce238 (patch)
tree367ac5a6b5357bff26ca5d07d3fd07d44aae3c9f
parent95476bfcf64aa9cb43775ebfe3410ce9565de4d5 (diff)
macOS: restore hidden popup windows
We need to to explicitly unhide popup windows that were previously explicitly hidden by applicationWillHide, so that their visibility will be effectively restored when the application is unhidden (otherwise the windows are gone forever even though their internal visibility is set to true). Change-Id: I4dbd209b07f769cc815851b40c41db0739ca2dc9 Task-number: QTBUG-71014 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 221a8b0866..44ab16d300 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -86,6 +86,7 @@
#include <private/qguiapplication_p.h>
#include "qt_mac_p.h"
#include <qpa/qwindowsysteminterface.h>
+#include <qwindowdefs.h>
QT_USE_NAMESPACE
@@ -93,6 +94,7 @@ QT_USE_NAMESPACE
bool startedQuit;
NSObject <NSApplicationDelegate> *reflectionDelegate;
bool inLaunch;
+ QWindowList hiddenWindows;
}
+ (instancetype)sharedDelegate
@@ -322,12 +324,28 @@ QT_USE_NAMESPACE
// fact that the application itself is hidden, which will cause a problem when
// the application is made visible again.
const QWindowList topLevelWindows = QGuiApplication::topLevelWindows();
- for (QWindow *topLevelWindow : qAsConst(topLevelWindows)) {
- if ((topLevelWindow->type() & Qt::Popup) == Qt::Popup && topLevelWindow->isVisible())
+ for (QWindow *topLevelWindow : topLevelWindows) {
+ if ((topLevelWindow->type() & Qt::Popup) == Qt::Popup && topLevelWindow->isVisible()) {
topLevelWindow->hide();
+
+ if ((topLevelWindow->type() & Qt::Tool) == Qt::Tool)
+ hiddenWindows << topLevelWindow;
+ }
}
}
+- (void)applicationDidUnhide:(NSNotification *)notification
+{
+ if (reflectionDelegate
+ && [reflectionDelegate respondsToSelector:@selector(applicationDidUnhide:)])
+ [reflectionDelegate applicationDidUnhide:notification];
+
+ for (QWindow *window : qAsConst(hiddenWindows))
+ window->show();
+
+ hiddenWindows.clear();
+}
+
- (void)applicationDidBecomeActive:(NSNotification *)notification
{
if (reflectionDelegate