summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-01-22 16:00:17 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-01-25 18:26:47 +0100
commitaa3b42d6342c6756c3ce941db0bbf1122ae48224 (patch)
tree2bee5026f75c0ee2d8e752019b965b53f4fd9e61 /src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
parent0180a1ab8229c6a15d19317bf7680663ac402910 (diff)
macOS: Don't exec file dialogs via runModal unless they are app modal
Non-modal or window modal dialogs are shown at show(), via AppKit APIs that are non-blocking. If we want to block execution at this point, we need to spin our own event loop. The runModal API of NSSavePanel is not meant to be used for blocking execution for already shown dialogs, but is reserved for application modal dialogs. This means we no longer trip over AppKit's understanding of what state the dialog is in, which would result in the dialog not reporting back any files. It also allows us to remove the guard for closing dialogs twice. We now also correctly close and end the application modal session if the dialog is closed programmatically using Qt APIs. Task-number: QTBUG-89959 Fixes: QTBUG-85547 Pick-to: 6.0 5.15 Change-Id: Ida3dc404417789d4823822ecfbf0935591c23878 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafiledialoghelper.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
index 1d01c0d1cf..d730a063a3 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
@@ -48,6 +48,7 @@ QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QNSOpenSavePanelDelegate, NSObject<NSOpenSa
QT_BEGIN_NAMESPACE
+class QEventLoop;
class QFileDialog;
class QFileDialogPrivate;
@@ -84,6 +85,7 @@ public:
private:
QNSOpenSavePanelDelegate *mDelegate;
QUrl mDir;
+ QEventLoop *m_eventLoop = nullptr;
};
QT_END_NAMESPACE