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
|
|
@ -129,6 +129,7 @@ Item
|
|||
id: variantsSelectionMenu
|
||||
Instantiator
|
||||
{
|
||||
id: variantSelectionInstantiator
|
||||
model: UM.MachineVariantsModel { id: variantsModel }
|
||||
MenuItem
|
||||
{
|
||||
|
|
@ -136,7 +137,17 @@ Item
|
|||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: variantSelectionMenuGroup;
|
||||
onTriggered: UM.MachineManager.setActiveMachineVariant(variantsModel.getItem(index).name)
|
||||
onTriggered:
|
||||
{
|
||||
UM.MachineManager.setActiveMachineVariant(variantsModel.getItem(index).name);
|
||||
if (typeof(model) !== "undefined" && !model.active) {
|
||||
//Selecting a variant was canceled; undo menu selection
|
||||
checked = false;
|
||||
var activeMachineVariantName = UM.MachineManager.activeMachineVariant;
|
||||
var activeMachineVariantIndex = variantSelectionInstantiator.model.find("name", activeMachineVariantName);
|
||||
variantSelectionInstantiator.model.setProperty(activeMachineVariantIndex, "active", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
onObjectAdded: variantsSelectionMenu.insertItem(index, object)
|
||||
onObjectRemoved: variantsSelectionMenu.removeItem(object)
|
||||
|
|
@ -182,6 +193,7 @@ Item
|
|||
id: materialSelectionMenu
|
||||
Instantiator
|
||||
{
|
||||
id: materialSelectionInstantiator
|
||||
model: UM.MachineMaterialsModel { id: machineMaterialsModel }
|
||||
MenuItem
|
||||
{
|
||||
|
|
@ -189,7 +201,17 @@ Item
|
|||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: materialSelectionMenuGroup;
|
||||
onTriggered: UM.MachineManager.setActiveMaterial(machineMaterialsModel.getItem(index).name)
|
||||
onTriggered:
|
||||
{
|
||||
UM.MachineManager.setActiveMaterial(machineMaterialsModel.getItem(index).name);
|
||||
if (typeof(model) !== "undefined" && !model.active) {
|
||||
//Selecting a material was canceled; undo menu selection
|
||||
checked = false;
|
||||
var activeMaterialName = UM.MachineManager.activeMaterial;
|
||||
var activeMaterialIndex = materialSelectionInstantiator.model.find("name", activeMaterialName);
|
||||
materialSelectionInstantiator.model.setProperty(activeMaterialIndex, "active", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
onObjectAdded: materialSelectionMenu.insertItem(index, object)
|
||||
onObjectRemoved: materialSelectionMenu.removeItem(object)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue