macOS: Make QMacStyle::standardPalette() reflect the platform theme
This palette isn't usually used, and the platform theme's palette is preferred, but if a client asks for the standard palette (e.g. as used in the styles example) we should try to report a palette that gives the system look. Change-Id: Ie5e58c890c13c716a9e9b5093b954a737e550dee Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
6d61b10f65
commit
d5adaacbb2
@ -2555,11 +2555,12 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
|
||||
|
||||
QPalette QMacStyle::standardPalette() const
|
||||
{
|
||||
QPalette pal = QCommonStyle::standardPalette();
|
||||
pal.setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191));
|
||||
pal.setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191));
|
||||
pal.setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191));
|
||||
return pal;
|
||||
auto platformTheme = QGuiApplicationPrivate::platformTheme();
|
||||
auto styleNames = platformTheme->themeHint(QPlatformTheme::StyleNames);
|
||||
if (styleNames.toStringList().contains("macintosh"))
|
||||
return *platformTheme->palette();
|
||||
else
|
||||
return QStyle::standardPalette();
|
||||
}
|
||||
|
||||
int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w,
|
||||
|
Loading…
Reference in New Issue
Block a user