From c65192000e08ace9005018fe50b2f038f9c16749 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 21 Feb 2018 11:19:18 +0100 Subject: [PATCH] WIP: Fix material name fetching in QML --- resources/qml/SidebarHeader.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 2c99ce2dd3..b78cade1de 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -252,8 +252,18 @@ Column { id: materialSelection - text: Cura.MachineManager.currentRootMaterialName[base.currentExtruderIndex] - tooltip: Cura.MachineManager.currentRootMaterialName[base.currentExtruderIndex] + property var currentRootMaterialName: + { + var materials = Cura.MachineManager.currentRootMaterialName; + var materialName = ""; + if (base.currentExtruderIndex in materials) { + materialName = materials[base.currentExtruderIndex]; + } + return materialName; + } + + text: currentRootMaterialName + tooltip: currentRootMaterialName visible: Cura.MachineManager.hasMaterials enabled: !extrudersList.visible || base.currentExtruderIndex > -1 height: UM.Theme.getSize("setting_control").height