diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-03-06 10:57:27 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-03-07 14:04:09 +0100 |
commit | 4e59a5252c11738ce4849032a5aa2a23f97a18ed (patch) | |
tree | 9536448c208577fcb955cf54088559509f5ce08f /src/plugins/platforms/cocoa | |
parent | 4d091523443285f9d3ee51c063aac40d79be39d1 (diff) |
macOS: Use non-native app modal message box from nested event loops
The NSAlert does not stay open when ran from a nested event loop,
so we need to fall back to the cross platform dialog. The window
modal dialog does not have this issue.
Fixes: QTBUG-111524
Pick-to: 6.5 6.5.0
Change-Id: I63fba0a092018bb19edeef78c06587455d752235
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamessagedialog.mm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm index d5d9469832..8dcc5fab53 100644 --- a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm +++ b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm @@ -80,6 +80,11 @@ bool QCocoaMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality w if (!options()) return false; + if (windowModality == Qt::ApplicationModal && QThread::currentThread()->loopLevel() > 1) { + qCWarning(lcQpaDialogs, "Cannot use native application modal dialog from nested event loop"); + return false; + } + Q_ASSERT(!m_alert); m_alert = [NSAlert new]; m_alert.window.title = options()->windowTitle().toNSString(); |