Browse Source

Update RadioButton to new style

CURA-8688
j.delarago 3 years ago
parent
commit
7da5903ce3
1 changed files with 28 additions and 2 deletions
  1. 28 2
      resources/qml/Widgets/RadioButton.qml

+ 28 - 2
resources/qml/Widgets/RadioButton.qml

@@ -17,6 +17,31 @@ RadioButton
 
     font: UM.Theme.getFont("default")
 
+    states: [
+        State {
+            name: "checked"
+            when: radioButton.checked
+            PropertyChanges
+            {
+                target: indicator
+                color: UM.Theme.getColor("accent_1")
+                border.width: 0
+            }
+        },
+        State
+        {
+            name: "disabled"
+            when: !radioButton.enabled
+            PropertyChanges { target: indicator; color: UM.Theme.getColor("background_1")}
+        },
+        State
+        {
+            name: "highlighted"
+            when: radioButton.hovered || radioButton.activeFocus
+            PropertyChanges { target: indicator; border.color: UM.Theme.getColor("accent_1")}
+        }
+    ]
+
     background: Item
     {
         anchors.fill: parent
@@ -29,8 +54,9 @@ RadioButton
         anchors.verticalCenter: parent.verticalCenter
         anchors.alignWhenCentered: false
         radius: width / 2
+        color: UM.Theme.getColor("background_2")
         border.width: UM.Theme.getSize("default_lining").width
-        border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover")
+        border.color: UM.Theme.getColor("text_disabled")
 
         Rectangle
         {
@@ -38,7 +64,7 @@ RadioButton
             height: width
             anchors.centerIn: parent
             radius: width / 2
-            color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button")
+            color: radioButton.enabled ? UM.Theme.getColor("background_2") : UM.Theme.getColor("background_1")
             visible: radioButton.checked
         }
     }