mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 02:19:04 +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 { }
|
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…
x
Reference in New Issue
Block a user