mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 22:39:02 +08:00
Properly set the current index of variant/profile combo boxes
This commit is contained in:
parent
5aa95f1258
commit
f7ecc1dc40
@ -78,6 +78,16 @@ Rectangle {
|
||||
model: UM.MachineVariantsModel { }
|
||||
textRole: "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 { }
|
||||
textRole: "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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user