Add reusable style for comboboxes to the theme

CURA-790
This commit is contained in:
fieldOfView 2016-04-27 10:28:58 +02:00
parent 6907c8921e
commit 4a2b1af9f5
2 changed files with 48 additions and 0 deletions

View file

@ -307,6 +307,7 @@ Item
model: extruderModel
anchors.top: parent.top
anchors.left: supportExtruderLabel.right
style: UM.Theme.styles.combobox
}
Label {
@ -325,6 +326,7 @@ Item
anchors.top: mainExtruderCombobox.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.left: supportExtruderLabel.right
style: UM.Theme.styles.combobox
}
ListModel {

View file

@ -309,6 +309,52 @@ QtObject {
unitFont: Theme.getFont("default");
}
property Component combobox: Component {
ComboBoxStyle {
background: Rectangle {
implicitHeight: UM.Theme.getSize("setting_control").height;
implicitWidth: UM.Theme.getSize("setting_control").width;
color: control.hovered ? Theme.getColor("setting_control_highlight") : Theme.getColor("setting_control");
Behavior on color { ColorAnimation { duration: 50; } }
border.width: Theme.getSize("default_lining").width;
border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border");
}
label: Item {
Label {
anchors.left: parent.left;
anchors.leftMargin: Theme.getSize("default_lining").width
anchors.right: downArrow.left;
anchors.rightMargin: Theme.getSize("default_lining").width;
anchors.verticalCenter: parent.verticalCenter;
text: control.currentText;
font: UM.Theme.getFont("default");
color: !enabled ? Theme.getColor("setting_control_disabled_text") : Theme.getColor("setting_control_text");
elide: Text.ElideRight;
verticalAlignment: Text.AlignVCenter;
}
UM.RecolorImage {
id: downArrow
anchors.right: parent.right;
anchors.rightMargin: Theme.getSize("default_lining").width * 2;
anchors.verticalCenter: parent.verticalCenter;
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5
sourceSize.height: width + 5
color: Theme.getColor("setting_control_text");
}
}
}
}
property Component checkbox: Component {
CheckBoxStyle {
background: Item { }