From fae0899efee37b238f35ec948a6d2a3b78f8bc6f Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Wed, 16 Oct 2024 15:41:15 +0200 Subject: [PATCH] QWindows11Style: Grey out disabled Widgets in light theme Disabled widgets were drawn in the same colors as active widgets, making them hard to distinguish. Fixes: QTBUG-130123 Change-Id: I723a1d5d3a90d56cc3e82148939ae3eaacd01ed4 Reviewed-by: Oliver Wolff (cherry picked from commit 9523b97eb9146e308b25ef19394c48ec636a73ea) Reviewed-by: Qt Cherry-pick Bot --- .../styles/modernwindows/qwindows11style.cpp | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 2f73c1732eb..ff9a04ada23 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -2229,22 +2229,39 @@ static void populateLightSystemBasePalette(QPalette &result) const QColor btnHighlight = result.accent().color(); const QColor btnColor = result.button().color(); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Highlight, btnHighlight); - SET_IF_UNRESOLVED(QPalette::All, QPalette::WindowText, textColor); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Button, btnFace); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Light, btnColor.lighter(150)); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Dark, btnColor.darker(200)); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Mid, btnColor.darker(150)); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Text, textColor); - SET_IF_UNRESOLVED(QPalette::All, QPalette::BrightText, btnHighlight); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Base, btnFace); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Window, QColor(0xF3,0xF3,0xF3,0xFF)); - SET_IF_UNRESOLVED(QPalette::All, QPalette::ButtonText, textColor); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Midlight, btnColor.lighter(125)); - SET_IF_UNRESOLVED(QPalette::All, QPalette::Shadow, Qt::black); - SET_IF_UNRESOLVED(QPalette::All, QPalette::ToolTipBase, result.window().color()); - SET_IF_UNRESOLVED(QPalette::All, QPalette::ToolTipText, result.windowText().color()); - SET_IF_UNRESOLVED(QPalette::All, QPalette::AlternateBase, alternateBase); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Highlight, btnHighlight); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::WindowText, textColor); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Button, btnFace); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Light, btnColor.lighter(150)); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Dark, btnColor.darker(200)); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Mid, btnColor.darker(150)); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Text, textColor); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::BrightText, btnHighlight); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Base, btnFace); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Window, QColor(0xF3,0xF3,0xF3,0xFF)); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::ButtonText, textColor); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Midlight, btnColor.lighter(125)); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::Shadow, Qt::black); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::ToolTipBase, result.window().color()); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::ToolTipText, result.windowText().color()); + SET_IF_UNRESOLVED(QPalette::Active, QPalette::AlternateBase, alternateBase); + + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Highlight, btnHighlight); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::WindowText, textColor); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Button, btnFace); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Light, btnColor.lighter(150)); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Dark, btnColor.darker(200)); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Mid, btnColor.darker(150)); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Text, textColor); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::BrightText, btnHighlight); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Base, btnFace); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Window, QColor(0xF3,0xF3,0xF3,0xFF)); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::ButtonText, textColor); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Midlight, btnColor.lighter(125)); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::Shadow, Qt::black); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::ToolTipBase, result.window().color()); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::ToolTipText, result.windowText().color()); + SET_IF_UNRESOLVED(QPalette::Inactive, QPalette::AlternateBase, alternateBase); result.setColor(QPalette::Disabled, QPalette::WindowText, textDisabled);