mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 13:49:02 +08:00
Make Extruder setting type update its color properly
The binding for the material color would not get updated properly when the model changes. This fixes that. Contributes to CURA-3804
This commit is contained in:
parent
a9ec3f2712
commit
20e46f4d8b
@ -17,7 +17,7 @@ SettingItem
|
|||||||
id: control
|
id: control
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
model: Cura.ExtrudersModel { }
|
model: Cura.ExtrudersModel { onModelChanged: control.color = getItem(control.currentIndex).color }
|
||||||
|
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
|
|
||||||
@ -36,6 +36,17 @@ SettingItem
|
|||||||
onWheel: wheel.accepted = true;
|
onWheel: wheel.accepted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property string color: "#fff"
|
||||||
|
|
||||||
|
Binding
|
||||||
|
{
|
||||||
|
// We override the color property's value when the ExtruderModel changes. So we need to use an
|
||||||
|
// explicit binding here otherwise we do not handle value changes after the model changes.
|
||||||
|
target: control
|
||||||
|
property: "color"
|
||||||
|
value: control.currentText != "" ? control.model.getItem(control.currentIndex).color : ""
|
||||||
|
}
|
||||||
|
|
||||||
style: ComboBoxStyle
|
style: ComboBoxStyle
|
||||||
{
|
{
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
@ -83,7 +94,7 @@ SettingItem
|
|||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
|
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
|
||||||
|
|
||||||
color: control.currentText != "" ? control.model.getItem(control.currentIndex).color : ""
|
color: control.color
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user