mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 16:27:51 -06:00
Update swatch colors when changing materials
CURA-1971
This commit is contained in:
parent
717fac3d78
commit
b6bf02e0a0
2 changed files with 13 additions and 4 deletions
|
@ -128,7 +128,11 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
onActivated: UM.ActiveTool.setProperty("SelectedActiveExtruder", extruders_model.getItem(index).id);
|
||||
onActivated:
|
||||
{
|
||||
UM.ActiveTool.setProperty("SelectedActiveExtruder", extruders_model.getItem(index).id);
|
||||
extruderSelector.color = extruders_model.getItem(index).color;
|
||||
}
|
||||
onModelChanged: updateCurrentIndex();
|
||||
|
||||
function updateCurrentIndex()
|
||||
|
|
|
@ -19,7 +19,10 @@ SettingItem
|
|||
model: Cura.ExtrudersModel
|
||||
{
|
||||
id: extruders_model
|
||||
onModelChanged: control.color = extruders_model.getItem(control.currentIndex).color
|
||||
}
|
||||
property string color: extruders_model.getItem(control.currentIndex).color
|
||||
|
||||
textRole: "name"
|
||||
|
||||
anchors.fill: parent
|
||||
|
@ -64,7 +67,7 @@ SettingItem
|
|||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
color: extruders_model.getItem(control.currentIndex).color
|
||||
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")
|
||||
}
|
||||
|
@ -105,7 +108,8 @@ SettingItem
|
|||
onActivated:
|
||||
{
|
||||
forceActiveFocus();
|
||||
propertyProvider.setPropertyValue("value", extruders_model.getItem(index).index)
|
||||
propertyProvider.setPropertyValue("value", extruders_model.getItem(index).index);
|
||||
control.color = extruders_model.getItem(index).color;
|
||||
}
|
||||
onModelChanged: updateCurrentIndex();
|
||||
|
||||
|
@ -121,7 +125,8 @@ SettingItem
|
|||
{
|
||||
if(extruders_model.getItem(i).index == propertyProvider.properties.value)
|
||||
{
|
||||
currentIndex = i;
|
||||
control.currentIndex = i;
|
||||
control.color = extruders_model.getItem(i).color;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue