From 124e63965ee73bb620fdefe3f9d2307f1d5830c5 Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Mon, 15 Jan 2024 12:32:52 +0100 Subject: [PATCH] QWindows11Style: Fix QMessageBox drawing for light/dark mode Fixes: QTBUG-120748 Change-Id: I4101848e2e91c489cb53b38ae6bf0171701c5c54 Reviewed-by: Oliver Wolff (cherry picked from commit 27dea6cf23c22c8ee2f82d97486f248559e57993) Reviewed-by: Qt Cherry-pick Bot --- .../styles/modernwindows/qwindows11style.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index d7548b6517f..bf015c53aee 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -765,6 +765,21 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption } } break; + case QStyle::PE_Widget: { +#if QT_CONFIG(dialogbuttonbox) + const QDialogButtonBox *buttonBox = nullptr; + if (qobject_cast (widget)) + buttonBox = widget->findChild(QLatin1String("qt_msgbox_buttonbox")); +#if QT_CONFIG(inputdialog) + else if (qobject_cast (widget)) + buttonBox = widget->findChild(QLatin1String("qt_inputdlg_buttonbox")); +#endif // QT_CONFIG(inputdialog) + if (buttonBox) { + painter->fillRect(option->rect,option->palette.window()); + } +#endif + break; + } default: QWindowsVistaStyle::drawPrimitive(element, option, painter, widget); }