mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 14:04:03 -06: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
1 changed files with 13 additions and 2 deletions
|
@ -17,7 +17,7 @@ SettingItem
|
|||
id: control
|
||||
anchors.fill: parent
|
||||
|
||||
model: Cura.ExtrudersModel { }
|
||||
model: Cura.ExtrudersModel { onModelChanged: control.color = getItem(control.currentIndex).color }
|
||||
|
||||
textRole: "name"
|
||||
|
||||
|
@ -36,6 +36,17 @@ SettingItem
|
|||
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
|
||||
{
|
||||
background: Rectangle
|
||||
|
@ -83,7 +94,7 @@ SettingItem
|
|||
border.width: UM.Theme.getSize("default_lining").width
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue