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>
This commit is contained in:
parent
95476bfcf6
commit
d02fed6781
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user