QWindowsTheme: Set highlight color to accent color in light mode

GetSysColor(COLOR_HIGHLIGHT) did not report the right highlight color in
light mode palette, Leading to a wrong accent color on
Windows. This patch uses the accent color analog to the dark mode
palette for QPalette::Highlight.

Fixes: QTBUG-130458
Pick-to: 6.9 6.8
Change-Id: If21f392e31c3187c28e871919ff17f417c8d144b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
Wladimir Leuschner 2024-10-29 10:50:52 +01:00
parent 5be7a9773e
commit a55db2cbee

View File

@ -287,6 +287,7 @@ void QWindowsTheme::populateLightSystemBasePalette(QPalette &result)
const QColor background = getSysColor(COLOR_BTNFACE);
const QColor textColor = getSysColor(COLOR_WINDOWTEXT);
const QColor accent = qt_accentColor(AccentColorNormal);
const QColor accentDark = qt_accentColor(AccentColorDark);
const QColor accentDarker = qt_accentColor(AccentColorDarker);
const QColor accentDarkest = qt_accentColor(AccentColorDarkest);
@ -295,7 +296,7 @@ void QWindowsTheme::populateLightSystemBasePalette(QPalette &result)
const QColor btnFace = background;
const QColor btnHighlight = getSysColor(COLOR_BTNHIGHLIGHT);
result.setColor(QPalette::Highlight, getSysColor(COLOR_HIGHLIGHT));
result.setColor(QPalette::Highlight, accent);
result.setColor(QPalette::WindowText, getSysColor(COLOR_WINDOWTEXT));
result.setColor(QPalette::Button, btnFace);
result.setColor(QPalette::Light, btnHighlight);