Qt: Fix white-on-light icon colours in Classic Windows theme

pull/3750/head
Stenzek 4 months ago
parent 37878497b6
commit 2a32d70144
No known key found for this signature in database

@ -29,25 +29,13 @@ static QColor GetIconColorFromPalette(QIcon::Mode mode, QIcon::State state)
// Thank gosh these are copy-on-write... // Thank gosh these are copy-on-write...
const QPalette palette = QApplication::palette(); const QPalette palette = QApplication::palette();
// For the "On" state (e.g., checked icons), use highlight/button colors // For the "On" state (e.g., checked icons)
if (state == QIcon::On)
{
if (mode == QIcon::Disabled)
return palette.color(QPalette::Disabled, QPalette::ButtonText);
else if (mode == QIcon::Selected)
return palette.color(QPalette::Current, QPalette::HighlightedText);
else
return palette.color(QPalette::Normal, QPalette::ButtonText);
}
// For the "Off" state (normal/unchecked) // For the "Off" state (normal/unchecked)
// NOTE: Active and Normal are the same in QPalette. // NOTE: Active and Normal are the same in QPalette.
if (mode == QIcon::Disabled) const QPalette::ColorGroup cgroup =
return palette.color(QPalette::Disabled, QPalette::WindowText); (mode == QIcon::Disabled) ? QPalette::Disabled : ((mode == QIcon::Selected) ? QPalette::Current : QPalette::Normal);
else if (mode == QIcon::Selected) const QPalette::ColorRole crole = (state == QIcon::On) ? QPalette::ButtonText : QPalette::WindowText;
return palette.color(QPalette::Current, QPalette::HighlightedText); return palette.color(cgroup, crole);
else
return palette.color(QPalette::Normal, QPalette::WindowText);
} }
/// Constructs a cache key for the given resource path, pixel size, and RGBA color value. /// Constructs a cache key for the given resource path, pixel size, and RGBA color value.

Loading…
Cancel
Save