mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 13:15:57 +08:00
Added color to recommended view support extruder by adding combobox_color style. CURA-2767
This commit is contained in:
parent
c27219b1c4
commit
ef6e90283e
@ -290,6 +290,12 @@ Item
|
||||
id: supportExtruderCombobox
|
||||
visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)
|
||||
model: extruderModel
|
||||
property string color:
|
||||
{
|
||||
var model_color = extruderModel.get(currentIndex).color;
|
||||
return (model_color) ? model_color : "";
|
||||
}
|
||||
|
||||
textRole: 'text' // this solves that the combobox isn't populated in the first time Cura is started
|
||||
|
||||
anchors.top: enableSupportCheckBox.bottom
|
||||
@ -320,7 +326,7 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
style: UM.Theme.styles.combobox
|
||||
style: UM.Theme.styles.combobox_color
|
||||
enabled: base.settingsEnabled
|
||||
property alias _hovered: supportExtruderMouseArea.containsMouse
|
||||
|
||||
@ -347,6 +353,9 @@ Item
|
||||
base.hideTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
// color rectangle
|
||||
|
||||
}
|
||||
|
||||
Label
|
||||
|
@ -411,6 +411,80 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
// Combobox with items with colored rectangles
|
||||
property Component combobox_color: Component {
|
||||
ComboBoxStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
color:
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_disabled");
|
||||
}
|
||||
if(control.hovered)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_highlight");
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("setting_control");
|
||||
}
|
||||
}
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
|
||||
}
|
||||
label: Item
|
||||
{
|
||||
Rectangle
|
||||
{
|
||||
id: swatch
|
||||
height: UM.Theme.getSize("setting_control").height / 2
|
||||
width: height
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
color: control.color
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border")
|
||||
}
|
||||
Label
|
||||
{
|
||||
anchors.left: swatch.right
|
||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||
anchors.right: downArrow.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_lining").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
text: control.currentText
|
||||
font: UM.Theme.getFont("default")
|
||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
||||
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: downArrow
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.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: UM.Theme.getColor("setting_control_text")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Component checkbox: Component {
|
||||
CheckBoxStyle {
|
||||
background: Item { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user