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
Pick-to: 6.8
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>
This commit is contained in:
Wladimir Leuschner 2024-12-09 11:50:36 +01:00 committed by Qt Cherry-pick Bot
parent 901731ad78
commit 1a737083f1

View File

@ -2278,6 +2278,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
*/
@ -2288,6 +2302,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