QWindows11Style: Override alternate base color in darkmode

The alternate base color in darkmode was wrongly set to the accent color
instead of a lighter color. This patch overrides the alternate base
color for the QWindows11Style.

Fixes: QTBUG-131976
Change-Id: Ie8f50b0042ca7bf746224275abc0cd255df7a4ad
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 79aa4269bcbbedef8206d79318c199df7c8a3c9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 1a737083f1db32da9f5af45256a3e26b6029d2e3)
bb10
Wladimir Leuschner 2024-12-09 11:50:36 +01:00 committed by Qt Cherry-pick Bot
parent 4ef53255ed
commit 92e454c000
1 changed files with 16 additions and 0 deletions

View File

@ -2264,6 +2264,20 @@ static void populateLightSystemBasePalette(QPalette &result)
oldStyleSheet = qApp->styleSheet();
}
static void populateDarkSystemBasePalette(QPalette &result)
{
static QString oldStyleSheet;
const bool styleSheetChanged = oldStyleSheet != qApp->styleSheet();
const QColor alternateBase = QColor(0xFF,0xFF,0xFF,0x0F);
SET_IF_UNRESOLVED(QPalette::Active, QPalette::AlternateBase, alternateBase);
SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::AlternateBase, alternateBase);
oldStyleSheet = qApp->styleSheet();
}
/*!
\internal
*/
@ -2274,6 +2288,8 @@ void QWindows11Style::polish(QPalette& result)
if (!highContrastTheme && colorSchemeIndex == 0)
populateLightSystemBasePalette(result);
else if (!highContrastTheme && colorSchemeIndex == 1)
populateDarkSystemBasePalette(result);
const bool styleSheetChanged = false; // so the macro works