From 11241642b3873ddea7d5806c00639d7a66f28547 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 22 Sep 2017 16:15:38 +0200 Subject: [PATCH] CURA-4354 fixed plugin injected tool icon path finding, example in PerObjectSettingsTool --- plugins/PerObjectSettingsTool/__init__.py | 2 +- plugins/PerObjectSettingsTool/tool_icon.svg | 3 +++ resources/qml/Toolbar.qml | 26 +++++++-------------- 3 files changed, 12 insertions(+), 19 deletions(-) create mode 100644 plugins/PerObjectSettingsTool/tool_icon.svg diff --git a/plugins/PerObjectSettingsTool/__init__.py b/plugins/PerObjectSettingsTool/__init__.py index eb102fde5d..214820acf2 100644 --- a/plugins/PerObjectSettingsTool/__init__.py +++ b/plugins/PerObjectSettingsTool/__init__.py @@ -13,7 +13,7 @@ def getMetaData(): "tool": { "name": i18n_catalog.i18nc("@label", "Per Model Settings"), "description": i18n_catalog.i18nc("@info:tooltip", "Configure Per Model Settings"), - "icon": "setting_per_object", + "icon": "tool_icon.svg", "tool_panel": "PerObjectSettingsPanel.qml", "weight": 3 }, diff --git a/plugins/PerObjectSettingsTool/tool_icon.svg b/plugins/PerObjectSettingsTool/tool_icon.svg new file mode 100644 index 0000000000..4b15eb453f --- /dev/null +++ b/plugins/PerObjectSettingsTool/tool_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index bc7905c527..dd57fcc78b 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -34,28 +34,18 @@ Item Button { text: model.name - iconSource: - { - var result = UM.Theme.getIcon(model.icon) - if(result == "") - { - return model.location + "/" + model.icon - } - return result - } + iconSource: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon + checkable: true + checked: model.active + enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled + style: UM.Theme.styles.tool_button - checkable: true; - checked: model.active; - enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled; - - style: UM.Theme.styles.tool_button; - onCheckedChanged: - { - if(checked) - { + onCheckedChanged: { + if (checked) { base.activeY = y } } + //Workaround since using ToolButton"s onClicked would break the binding of the checked property, instead //just catch the click so we do not trigger that behaviour. MouseArea