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 <axel.spoerl@qt.io>
bb10
Mitch Curtis 2023-10-10 13:39:06 +08:00
parent 11424b3f51
commit b90b624ce0
1 changed files with 6 additions and 2 deletions

View File

@ -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());