mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -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
|
|
@ -49,6 +49,7 @@ Item{
|
|||
id: profileSelectionMenu
|
||||
Instantiator
|
||||
{
|
||||
id: profileSelectionInstantiator
|
||||
model: UM.ProfilesModel { }
|
||||
MenuItem
|
||||
{
|
||||
|
|
@ -56,7 +57,17 @@ Item{
|
|||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: profileSelectionMenuGroup;
|
||||
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 = profileSelectionInstantiator.model.find("name", activeProfileName);
|
||||
profileSelectionInstantiator.model.setProperty(activeProfileIndex, "active", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
onObjectAdded: profileSelectionMenu.insertItem(index, object)
|
||||
onObjectRemoved: profileSelectionMenu.removeItem(object)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue