Fix favorite not being checked properly in MaterialMenu

CURA-6804
This commit is contained in:
Jaime van Kessel 2019-09-23 11:18:47 +02:00
parent 71a22bf194
commit a4ed51342c
No known key found for this signature in database
GPG Key ID: 3710727397403C91

View File

@ -14,8 +14,7 @@ Menu
property int extruderIndex: 0 property int extruderIndex: 0
property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex] property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex]
property string activeMaterialId: Cura.MachineManager.activeMachine.extruderList[extruderIndex].material.id
property string activeMaterialId: Cura.MachineManager.activeMachine.extruders[extruderIndex].material.id
property bool updateModels: true property bool updateModels: true
Cura.FavoriteMaterialsModel Cura.FavoriteMaterialsModel
{ {
@ -53,7 +52,7 @@ Menu
checkable: true checkable: true
checked: model.root_material_id === menu.currentRootMaterialId checked: model.root_material_id === menu.currentRootMaterialId
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node) onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
exclusiveGroup: group exclusiveGroup: favoriteGroup // One favorite and one item from the others can be active at the same time.
} }
onObjectAdded: menu.insertItem(index, object) onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(index) onObjectRemoved: menu.removeItem(index)
@ -127,10 +126,16 @@ Menu
onObjectRemoved: menu.removeItem(object) onObjectRemoved: menu.removeItem(object)
} }
ExclusiveGroup { ExclusiveGroup
{
id: group id: group
} }
ExclusiveGroup
{
id: favoriteGroup
}
MenuSeparator {} MenuSeparator {}
MenuItem MenuItem