Reset dark palettes for widgets to light in windows style
Windows theme in dark mode set dark palettes for checkbox,
radiobutton, menu, menubar explicitly. The fix added as part of
a2518b4140 (to use light palette for
windows style) overrides only system palette and widget specific
palettes are still with dark palettes.
In this patch, the windows style overwrite dark with light palette
for widgets that are explicitly set with dark palette in windows
theme.
Fixes: QTBUG-110432
Pick-to: 6.5
Change-Id: I2af0e517d62981f062244eeab8f1b5e5442cc451
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
parent
0b20f243f7
commit
9a1b7c7fa5
|
|
@ -4811,6 +4811,41 @@ void QWindowsVistaStyle::polish(QPalette &pal)
|
|||
pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(104));
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QWindowsVistaStyle::polish(QApplication *app)
|
||||
{
|
||||
// Override windows theme palettes to light
|
||||
if (qApp->styleHints()->appearance() == Qt::Appearance::Dark) {
|
||||
static const char* themedWidgets[] = {
|
||||
"QToolButton",
|
||||
"QAbstractButton",
|
||||
"QCheckBox",
|
||||
"QRadioButton",
|
||||
"QHeaderView",
|
||||
"QAbstractItemView",
|
||||
"QMessageBoxLabel",
|
||||
"QTabBar",
|
||||
"QLabel",
|
||||
"QGroupBox",
|
||||
"QMenu",
|
||||
"QMenuBar",
|
||||
"QTextEdit",
|
||||
"QTextControl",
|
||||
"QLineEdit"
|
||||
};
|
||||
for (const auto& themedWidget : std::as_const(themedWidgets)) {
|
||||
auto defaultResolveMask = QApplication::palette().resolveMask();
|
||||
auto widgetResolveMask = QApplication::palette(themedWidget).resolveMask();
|
||||
if (widgetResolveMask != defaultResolveMask)
|
||||
QApplication::setPalette(QApplication::palette(), themedWidget);
|
||||
}
|
||||
}
|
||||
|
||||
QWindowsStyle::polish(app);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public:
|
|||
void polish(QWidget *widget) override;
|
||||
void unpolish(QWidget *widget) override;
|
||||
void polish(QPalette &pal) override;
|
||||
void polish(QApplication *app) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY_MOVE(QWindowsVistaStyle)
|
||||
|
|
|
|||
Loading…
Reference in New Issue