Reduce the creations of ExtrudersModels

CURA-6015
This commit is contained in:
Lipu Fei 2018-12-12 11:08:33 +01:00
parent 2cf80b4578
commit 620790ae3d
15 changed files with 44 additions and 34 deletions

View file

@ -17,11 +17,16 @@ SettingItem
id: control
anchors.fill: parent
model: Cura.ExtrudersModel
property var extrudersModel: CuraApplication.getExtrudersModel()
model: extrudersModel
Connections
{
target: extrudersModel
onModelChanged:
{
control.color = getItem(control.currentIndex).color
control.color = extrudersModel.getItem(control.currentIndex).color
}
}

View file

@ -17,10 +17,12 @@ SettingItem
id: control
anchors.fill: parent
model: Cura.ExtrudersModel
model: CuraApplication.getExtrudersModelWithOptional()
Connections
{
onModelChanged: control.color = getItem(control.currentIndex).color
addOptionalExtruder: true
target: model
onModelChanged: control.color = model.getItem(control.currentIndex).color
}
textRole: "name"