mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 11:45:56 +08:00
Reset menu selection when canceling profile switch
Contributes to CURA-853
This commit is contained in:
parent
69331696f0
commit
5613a5de20
@ -214,13 +214,24 @@ UM.MainWindow
|
|||||||
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
|
id: profileMenuInstantiator
|
||||||
model: UM.ProfilesModel { }
|
model: UM.ProfilesModel { }
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: model.name;
|
text: model.name;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.active;
|
||||||
exclusiveGroup: profileMenuGroup;
|
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)
|
onObjectAdded: profileMenu.insertItem(index, object)
|
||||||
onObjectRemoved: profileMenu.removeItem(object)
|
onObjectRemoved: profileMenu.removeItem(object)
|
||||||
|
@ -49,6 +49,7 @@ Item{
|
|||||||
id: profileSelectionMenu
|
id: profileSelectionMenu
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
|
id: profileSelectionInstantiator
|
||||||
model: UM.ProfilesModel { }
|
model: UM.ProfilesModel { }
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
@ -56,7 +57,17 @@ Item{
|
|||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.active;
|
||||||
exclusiveGroup: profileSelectionMenuGroup;
|
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)
|
onObjectAdded: profileSelectionMenu.insertItem(index, object)
|
||||||
onObjectRemoved: profileSelectionMenu.removeItem(object)
|
onObjectRemoved: profileSelectionMenu.removeItem(object)
|
||||||
|
@ -129,6 +129,7 @@ Item
|
|||||||
id: variantsSelectionMenu
|
id: variantsSelectionMenu
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
|
id: variantSelectionInstantiator
|
||||||
model: UM.MachineVariantsModel { id: variantsModel }
|
model: UM.MachineVariantsModel { id: variantsModel }
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
@ -136,7 +137,17 @@ Item
|
|||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.active;
|
||||||
exclusiveGroup: variantSelectionMenuGroup;
|
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)
|
onObjectAdded: variantsSelectionMenu.insertItem(index, object)
|
||||||
onObjectRemoved: variantsSelectionMenu.removeItem(object)
|
onObjectRemoved: variantsSelectionMenu.removeItem(object)
|
||||||
@ -182,6 +193,7 @@ Item
|
|||||||
id: materialSelectionMenu
|
id: materialSelectionMenu
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
|
id: materialSelectionInstantiator
|
||||||
model: UM.MachineMaterialsModel { id: machineMaterialsModel }
|
model: UM.MachineMaterialsModel { id: machineMaterialsModel }
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
@ -189,7 +201,17 @@ Item
|
|||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.active;
|
||||||
exclusiveGroup: materialSelectionMenuGroup;
|
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)
|
onObjectAdded: materialSelectionMenu.insertItem(index, object)
|
||||||
onObjectRemoved: materialSelectionMenu.removeItem(object)
|
onObjectRemoved: materialSelectionMenu.removeItem(object)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user