mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-28 05:11:04 -07:00
Reset menu selection when canceling profile switch
Contributes to CURA-853
This commit is contained in:
parent
69331696f0
commit
5613a5de20
3 changed files with 48 additions and 4 deletions
|
|
@ -214,13 +214,24 @@ UM.MainWindow
|
|||
|
||||
Instantiator
|
||||
{
|
||||
id: profileMenuInstantiator
|
||||
model: UM.ProfilesModel { }
|
||||
MenuItem {
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: profileMenuGroup;
|
||||
onTriggered: UM.MachineManager.setActiveProfile(model.name)
|
||||
onTriggered:
|
||||
{
|
||||
UM.MachineManager.setActiveProfile(model.name);
|
||||
if (!model.active) {
|
||||
//Selecting a profile was canceled; undo menu selection
|
||||
checked = false;
|
||||
var activeProfileName = UM.MachineManager.activeProfile;
|
||||
var activeProfileIndex = profileMenuInstantiator.model.find("name", activeProfileName);
|
||||
profileMenuInstantiator.model.setProperty(activeProfileIndex, "active", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
onObjectAdded: profileMenu.insertItem(index, object)
|
||||
onObjectRemoved: profileMenu.removeItem(object)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue