QWindows11Style: Fix QMessageBox drawing for light/dark mode

Fixes: QTBUG-120748
Change-Id: I4101848e2e91c489cb53b38ae6bf0171701c5c54
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 27dea6cf23c22c8ee2f82d97486f248559e57993)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2024-01-15 12:32:52 +01:00 committed by Qt Cherry-pick Bot
parent b2eb82a42f
commit 124e63965e

View File

@ -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<const QMessageBox *> (widget))
buttonBox = widget->findChild<const QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox"));
#if QT_CONFIG(inputdialog)
else if (qobject_cast<const QInputDialog *> (widget))
buttonBox = widget->findChild<const QDialogButtonBox *>(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);
}