diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2023-09-06 14:30:24 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-11-10 20:54:51 +0100 |
commit | 1d80626400f6b86ccb13f09f4c5f5be198571694 (patch) | |
tree | d9ff6660991df7ed90032f133c30c1b324dda7a5 | |
parent | a1e143faabd5dd97ca2bb196cd6863609619913b (diff) |
macOS: Use non-native fallback for message boxes with rich text
The NSAlert messageText and informativeText properties only allow
plain NSString, so we need to opt out of the native dialog if the
user has requested rich text for any of these properties.
Fixes: QTBUG-116757
Pick-to: 6.5
Change-Id: I3fd44ec94adad1dda1ed4dede46450a8a525d35f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 28ab45182a3fea76193146083838cca4212395d2)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamessagedialog.mm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm index 43d767d32b..b09f6bf54e 100644 --- a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm +++ b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm @@ -91,6 +91,13 @@ bool QCocoaMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality w if (!options()) return false; + if (Qt::mightBeRichText(options()->text()) || + Qt::mightBeRichText(options()->informativeText())) { + // Let's fallback to non-native message box, + // we only have plain NSString/text in NSAlert. + qCDebug(lcQpaDialogs, "Message box contains text in rich text format"); + return false; + } Q_ASSERT(!m_alert); m_alert = [NSAlert new]; |