From b90b624ce0e87a8c96ce12276aa60377a8de24ff Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 10 Oct 2023 13:39:06 +0800 Subject: [PATCH] QWindowsTheme: only set inactive accent color to Window if not set Otherwise it incorrectly changes to a white-ish color when the window becomes inactive, when native apps keep the accent color. Fixes: QTBUG-116826 Change-Id: I3837e7ca93a494e60dbe5f1b7f8607b3dd16d29e Reviewed-by: Axel Spoerl --- src/plugins/platforms/windows/qwindowstheme.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 4fccec98fb..636479b1e3 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -591,8 +591,12 @@ QPalette QWindowsTheme::systemPalette(Qt::ColorScheme colorScheme) result.color(QPalette::Inactive, QPalette::Window)); result.setColor(QPalette::Inactive, QPalette::HighlightedText, result.color(QPalette::Inactive, QPalette::Text)); - result.setColor(QPalette::Inactive, QPalette::Accent, - result.color(QPalette::Inactive, QPalette::Window)); + // Only set this if it hasn't been set. + if (!result.isBrushSet(QPalette::Inactive, QPalette::Accent)) { + // We set Accent to Window to match the behavior of Windows 11. + result.setColor(QPalette::Inactive, QPalette::Accent, + result.color(QPalette::Inactive, QPalette::Window)); + } } const QColor disabled = mixColors(result.windowText().color(), result.button().color());