Fix number of extruders not being updated

This commit is contained in:
Lipu Fei 2019-05-02 09:03:48 +02:00
parent 038a5b5942
commit b9d8b89113

View File

@ -285,18 +285,30 @@ Item
optionModel: ListModel optionModel: ListModel
{ {
id: extruderCountModel id: extruderCountModel
Component.onCompleted: Component.onCompleted:
{ {
extruderCountModel.clear() update()
}
function update()
{
clear()
for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++) for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i++)
{ {
// Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue() // Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue()
// takes a QVariant as value, and Number gets translated into a float. This will cause problem // takes a QVariant as value, and Number gets translated into a float. This will cause problem
// for integer settings such as "Number of Extruders". // for integer settings such as "Number of Extruders".
extruderCountModel.append({ text: String(i), value: String(i) }) append({ text: String(i), value: String(i) })
} }
} }
} }
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: extruderCountModel.update()
}
} }
} }
} }