mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-09-09 00:07:52 -06:00
Fix errors in SettingOptionalExtruder.qml
CURA-6015
This commit is contained in:
parent
d879cab91a
commit
8021c8e449
1 changed files with 10 additions and 3 deletions
|
@ -12,17 +12,24 @@ SettingItem
|
||||||
id: base
|
id: base
|
||||||
property var focusItem: control
|
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
|
contents: ComboBox
|
||||||
{
|
{
|
||||||
id: control
|
id: control
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
model: CuraApplication.getExtrudersModelWithOptional()
|
model: base.extrudersWithOptionalModel
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: model
|
target: base.extrudersWithOptionalModel
|
||||||
onModelChanged: control.color = model.getItem(control.currentIndex).color
|
onModelChanged: control.color = base.extrudersWithOptionalModel.getItem(control.currentIndex).color
|
||||||
}
|
}
|
||||||
|
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue