Fix errors in SettingOptionalExtruder.qml

CURA-6015
This commit is contained in:
Lipu Fei 2018-12-13 13:49:45 +01:00
parent d879cab91a
commit 8021c8e449

View file

@ -12,17 +12,24 @@ SettingItem
id: base
property var focusItem: control
// Somehow if we directory set control.model to CuraApplication.getExtrudersModelWithOptional()
// and in the Connections.onModelChanged use control.model as a reference, it will complain about
// non-existing properties such as "onModelChanged" and "getItem". I guess if we access the model
// via "control.model", it gives back a generic/abstract model instance. To avoid this, we add
// this extra property to keep the ExtrudersModel and use this in the rest of the code.
property var extrudersWithOptionalModel: CuraApplication.getExtrudersModelWithOptional()
contents: ComboBox
{
id: control
anchors.fill: parent
model: CuraApplication.getExtrudersModelWithOptional()
model: base.extrudersWithOptionalModel
Connections
{
target: model
onModelChanged: control.color = model.getItem(control.currentIndex).color
target: base.extrudersWithOptionalModel
onModelChanged: control.color = base.extrudersWithOptionalModel.getItem(control.currentIndex).color
}
textRole: "name"