From 32c5118ae486de22ece22da48ef00f2794569a5d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 5 Jul 2019 11:45:01 +0200 Subject: [PATCH] Add intents per category to the intent menu They are in the wrong order currently. The section headers all appear at the end and they are not greyed out. This must be fixed. The order might prove difficult... We'll see, but I want this locked in now because it works. Contributes to issue CURA-6597. --- resources/qml/Menus/IntentMenu.qml | 40 ++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/resources/qml/Menus/IntentMenu.qml b/resources/qml/Menus/IntentMenu.qml index 410ab70eb7..7e117acdb0 100644 --- a/resources/qml/Menus/IntentMenu.qml +++ b/resources/qml/Menus/IntentMenu.qml @@ -14,27 +14,47 @@ Menu property int extruderIndex: 0 - Cura.IntentModel + Cura.IntentCategoryModel { - id: intentModel + id: intentCategoryModel } Instantiator { - model: intentModel + model: intentCategoryModel - MenuItem + MenuItem //Section header. { text: model.name - checkable: true + checkable: false checked: false - Binding on checked + + property var per_category_intents: Cura.IntentModel { - when: Cura.MachineManager.activeStack != null - value: Cura.MachineManager.activeStack.intent == model.container + id: intentModel + intentCategory: model.intent_category + } + + property var intent_instantiator: Instantiator + { + model: intentModel + MenuItem + { + text: model.name + checkable: true + checked: false + Binding on checked + { + when: Cura.MachineManager.activeStack != null + value: Cura.MachineManager.activeStack.intent.metaData["intent_category"] == intentModel.intentCategory && Cura.MachineManager.activeStack.quality.metaData["quality_type"] == model.quality_type + } + exclusiveGroup: group + onTriggered: Cura.IntentManager.selectIntent(intentModel.intentCategory, model.quality_type) + } + + onObjectAdded: menu.insertItem(index, object) + onObjectRemoved: menu.removeItem(object) } - exclusiveGroup: group - onTriggered: Cura.MachineManager.activeStack.intent = model.container } onObjectAdded: menu.insertItem(index, object)