From a55db2cbee914d7bdc5678f35da297b79aec7613 Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Tue, 29 Oct 2024 10:50:52 +0100 Subject: [PATCH] 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 --- src/plugins/platforms/windows/qwindowstheme.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index e908f6d646a..7e0987f840a 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -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);