Skip to content

Commit

Permalink
QWindows11Style: Override alternate base color in darkmode
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit 79aa426)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
Wladimir Leuschner authored and Qt Cherry-pick Bot committed Dec 9, 2024
1 parent 901731a commit 1a73708
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/plugins/styles/modernwindows/qwindows11style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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

Expand Down

0 comments on commit 1a73708

Please sign in to comment.