Setting the support extruder in recommended mode now correctly updates them in custom

CURA-3033
This commit is contained in:
Jaime van Kessel 2016-11-25 11:28:38 +01:00
parent 510c988c43
commit 6d66ea51ad

View file

@ -30,6 +30,7 @@ SettingItem
textRole: "name"
anchors.fill: parent
onCurrentIndexChanged: updateCurrentColor();
MouseArea
{
@ -115,12 +116,37 @@ SettingItem
propertyProvider.setPropertyValue("value", extruders_model.getItem(index).index);
control.color = extruders_model.getItem(index).color;
}
onModelChanged: updateCurrentIndex();
Connections
Binding
{
target: propertyProvider
onPropertiesChanged: control.updateCurrentIndex();
target: control
property: "currentIndex"
value:
{
for(var i = 0; i < extruders_model.rowCount(); ++i)
{
if(extruders_model.getItem(i).index == propertyProvider.properties.value)
{
return i;
}
}
return -1;
}
}
// In some cases we want to update the current color without updating the currentIndex, so it's a seperate function.
function updateCurrentColor()
{
for(var i = 0; i < extruders_model.rowCount(); ++i)
{
if(extruders_model.getItem(i).index == propertyProvider.properties.value)
{
control.color = extruders_model.getItem(i).color;
return;
}
}
}
function updateCurrentIndex()
@ -130,7 +156,6 @@ SettingItem
if(extruders_model.getItem(i).index == propertyProvider.properties.value)
{
control.currentIndex = i;
control.color = extruders_model.getItem(i).color;
return;
}
}