mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Properly set the current index of variant/profile combo boxes
This commit is contained in:
parent
5aa95f1258
commit
f7ecc1dc40
1 changed files with 19 additions and 0 deletions
|
|
@ -78,6 +78,16 @@ Rectangle {
|
||||||
model: UM.MachineVariantsModel { }
|
model: UM.MachineVariantsModel { }
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
onActivated: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name);
|
onActivated: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name);
|
||||||
|
|
||||||
|
currentIndex: {
|
||||||
|
for(var i = 0; i < model.rowCount(); ++i) {
|
||||||
|
if(model.getItem(i).name == UM.MachineManager.activeMachineVariant) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,6 +108,15 @@ Rectangle {
|
||||||
model: UM.ProfilesModel { }
|
model: UM.ProfilesModel { }
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
onActivated: UM.MachineManager.setActiveProfile(model.getItem(index).name)
|
onActivated: UM.MachineManager.setActiveProfile(model.getItem(index).name)
|
||||||
|
|
||||||
|
currentIndex: {
|
||||||
|
for(var i = 0; i < model.rowCount(); ++i) {
|
||||||
|
if(model.getItem(i).name == UM.MachineManager.activeProfile)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue