From e53f38a78eff38348299f94da82b1c3d045872c6 Mon Sep 17 00:00:00 2001 From: Matthias Metelka <62722460+kleinerpirat@users.noreply.github.com> Date: Mon, 20 Feb 2023 09:27:12 +0100 Subject: [PATCH] Add missing Qt styles for disabled state (#2386) * Add missing styles for disabled state * Update aqt.rs --- build/configure/src/aqt.rs | 3 +++ qt/aqt/stylesheets.py | 53 ++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/build/configure/src/aqt.rs b/build/configure/src/aqt.rs index 82624f748..d2e5b160b 100644 --- a/build/configure/src/aqt.rs +++ b/build/configure/src/aqt.rs @@ -269,6 +269,9 @@ fn build_themed_icons(build: &mut Build) -> Result<()> { "chevron-down" => &["FG_DISABLED"], "drag-vertical" => &["FG_SUBTLE"], "drag-horizontal" => &["FG_SUBTLE"], + "check" => &["FG_DISABLED"], + "circle-medium" => &["FG_DISABLED"], + "minus-thick" => &["FG_DISABLED"], }; for icon_path in build.expand_inputs(inputs![":node_modules:mdi_themed"]) { let path = Utf8Path::new(&icon_path); diff --git a/qt/aqt/stylesheets.py b/qt/aqt/stylesheets.py index 508b7fd43..a5cd50841 100644 --- a/qt/aqt/stylesheets.py +++ b/qt/aqt/stylesheets.py @@ -103,6 +103,9 @@ class CustomStyles: QGroupBox#template_box::title {{ margin-top: 5px; left: 5px; + }} + QLabel:disabled {{ + color: {tm.var(colors.FG_DISABLED)}; }} """ @@ -265,6 +268,9 @@ class CustomStyles: QComboBox::down-arrow {{ image: url({tm.themed_icon("mdi:chevron-down")}); }} + QComboBox::down-arrow:disabled {{ + image: url({tm.themed_icon("mdi:chevron-down-FG_DISABLED")}); + }} QComboBox::drop-down:hover:editable {{ background: { button_gradient( @@ -463,18 +469,12 @@ class CustomStyles: width: 20px; height: 20px; }} - QSpinBox::up-button:disabled, QSpinBox::up-button:off, - QSpinBox::down-button:disabled, QSpinBox::down-button:off, - QDateTimeEdit::up-button:disabled, QDateTimeEdit::up-button:off, - QDateTimeEdit::down-button:disabled, QDateTimeEdit::down-button:off {{ - background: {tm.var(colors.BUTTON_DISABLED)}; - }} - QSpinBox::up-arrow:off, - QDateTimeEdit::up-arrow:off {{ + QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off, + QDateTimeEdit::up-arrow:disabled, QDateTimeEdit::up-arrow:off {{ image: url({tm.themed_icon("mdi:chevron-up-FG_DISABLED")}); }} - QSpinBox::down-arrow:off, - QDateTimeEdit::down-arrow:off {{ + QSpinBox::down-arrow:disabled, QSpinBox::down-arrow:off, + QDateTimeEdit::down-arrow:disabled, QDateTimeEdit::down-arrow:off {{ image: url({tm.themed_icon("mdi:chevron-down-FG_DISABLED")}); }} """ @@ -499,12 +499,12 @@ class CustomStyles: QMenu::indicator:exclusive {{ border-radius: 8px; }} - QCheckBox::indicator:focus, - QCheckBox::indicator:hover, - QCheckBox::indicator:checked:hover, - QRadioButton::indicator:focus, - QRadioButton::indicator:hover, - QRadioButton::indicator:checked:hover {{ + QCheckBox::indicator:focus:!disabled, + QCheckBox::indicator:hover:!disabled, + QCheckBox::indicator:checked:hover:!disabled, + QRadioButton::indicator:focus:!disabled, + QRadioButton::indicator:hover:!disabled, + QRadioButton::indicator:checked::!disabled {{ border: 2px solid {tm.var(colors.BORDER_STRONG)}; width: 14px; height: 14px; @@ -519,6 +519,27 @@ class CustomStyles: }} QCheckBox::indicator:indeterminate {{ image: url({tm.themed_icon("mdi:minus-thick")}); + }} + QCheckBox:disabled, + QRadioButton:disabled {{ + color: {tm.var(colors.FG_DISABLED)}; + }} + QCheckBox::indicator:disabled, + QRadioButton::indicator:disabled, + QMenu:indicator:disabled {{ + color: {tm.var(colors.FG_DISABLED)}; + border-color: {tm.var(colors.FG_DISABLED)}; + }} + QCheckBox::indicator:checked:disabled, + QRadioButton::indicator:checked:disabled, + QMenu::indicator:checked:disabled {{ + image: url({tm.themed_icon("mdi:check-FG_DISABLED")}); + }} + QRadioButton::indicator:checked:disabled {{ + image: url({tm.themed_icon("mdi:circle-medium-FG_DISABLED")}); + }} + QCheckBox::indicator:indeterminate:disabled {{ + image: url({tm.themed_icon("mdi:minus-thick-FG_DISABLED")}); }} """