Browse Source

Add combobox popup styling

fieldOfView 7 years ago
parent
commit
428dfeaed7
1 changed files with 29 additions and 2 deletions
  1. 29 2
      resources/qml/Settings/SettingComboBox.qml

+ 29 - 2
resources/qml/Settings/SettingComboBox.qml

@@ -86,13 +86,34 @@ SettingItem
             verticalAlignment: Text.AlignVCenter
         }
 
+        popup: Popup {
+            y: control.height - UM.Theme.getSize("default_lining").height
+            width: control.width
+            implicitHeight: contentItem.implicitHeight
+            padding: UM.Theme.getSize("default_lining").width
+
+            contentItem: ListView {
+                clip: true
+                implicitHeight: contentHeight
+                model: control.popup.visible ? control.delegateModel : null
+                currentIndex: control.highlightedIndex
+
+                ScrollIndicator.vertical: ScrollIndicator { }
+            }
+
+            background: Rectangle {
+                color: UM.Theme.getColor("setting_control")
+                border.color: UM.Theme.getColor("setting_control_border")
+            }
+        }
+
         delegate: ItemDelegate
         {
-            width: control.width
+            width: control.width - 2 * UM.Theme.getSize("default_lining").width
             height: control.height
             highlighted: control.highlightedIndex == index
 
-            contentItem: Text
+            contentItem: Label
             {
                 text: modelData.value
                 color: control.contentItem.color
@@ -100,6 +121,12 @@ SettingItem
                 elide: Text.ElideRight
                 verticalAlignment: Text.AlignVCenter
             }
+
+            background: Rectangle
+            {
+                color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent"
+                border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent"
+            }
         }
 
         onActivated: