QWindows11Style: Fix QMessageBox drawing for light/dark mode

Fixes: QTBUG-120748
Pick-to: 6.7
Change-Id: I4101848e2e91c489cb53b38ae6bf0171701c5c54
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
bb10
Wladimir Leuschner 2024-01-15 12:32:52 +01:00
parent 948b93a847
commit 27dea6cf23
1 changed files with 15 additions and 0 deletions

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);
}