diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-03-06 10:57:27 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-03-07 18:21:19 +0000 |
commit | 805f40924e2ff6949eebc93857866d9b02129982 (patch) | |
tree | fd609431017de1682b49d90ef6c8e120dee54266 | |
parent | 556a56104e64ccb8f18c3605ee21e3bc170a3cd3 (diff) | |
download | qtbase-805f40924e2ff6949eebc93857866d9b02129982.tar.gz |
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
Change-Id: I63fba0a092018bb19edeef78c06587455d752235
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4e59a5252c11738ce4849032a5aa2a23f97a18ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-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 21a423d407..8ba204752b 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(); |