From 04dda6cae05109ad5a3a681587ec9cd2cc49028a Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 14 Dec 2023 13:44:44 +0100 Subject: [PATCH] QMessageBox: don't use a native dialog if a style sheet is active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With 6.5 we try to use the native message dialog if we can, but we didn't account for the style sheet. This restores pre-6.5 behavior for QMessageBox. Other dialogs will continue to be native, even if a style sheet is in use. While this is inconsistent, the other dialogs are substantially more functional, so switching to the Qt version because of a style sheet being active would be a significant change of behavior. Pick-to: 6.5 Fixes: QTBUG-120054 Change-Id: I07eae609bc360140e096c5eb7ad004ffa4422123 Reviewed-by: Oliver Eftevaag Reviewed-by: Tor Arne Vestbø (cherry picked from commit 1b71e2d894c2be7052518cdcb96020c9950e2dc7) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 3158aa546d3a8e0430f079e0d8b2da0f330628d1) --- src/widgets/dialogs/qmessagebox.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index ce324464aca..a0e96aa5ffc 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -2811,6 +2811,7 @@ bool QMessageBoxPrivate::canBeNativeDialog() const return true; if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs) || q->testAttribute(Qt::WA_DontShowOnScreen) + || q->testAttribute(Qt::WA_StyleSheet) || (options->options() & QMessageDialogOptions::Option::DontUseNativeDialog)) { return false; }