From 99e6ec9509b2704e9d4639fc000cf874d7457e6b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 May 2019 14:29:05 +0200 Subject: [PATCH] Fix the last material qml warnings --- .../qml/Preferences/Materials/MaterialsPage.qml | 4 +++- .../qml/Preferences/Materials/MaterialsSlot.qml | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsPage.qml b/resources/qml/Preferences/Materials/MaterialsPage.qml index 26f858fcc8..ea24051e40 100644 --- a/resources/qml/Preferences/Materials/MaterialsPage.qml +++ b/resources/qml/Preferences/Materials/MaterialsPage.qml @@ -271,7 +271,9 @@ Item id: confirmRemoveMaterialDialog icon: StandardIcon.Question; title: catalog.i18nc("@title:window", "Confirm Remove") - text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItem.name) + property string materialName: base.currentItem !== null ? base.currentItem.name : "" + + text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(materialName) standardButtons: StandardButton.Yes | StandardButton.No modality: Qt.ApplicationModal onYes: diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index 2f4847103b..5a44fb49cc 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -19,8 +19,18 @@ Rectangle height: UM.Theme.getSize("favorites_row").height width: parent.width - color: material != null ? (base.currentItem.root_material_id == material.root_material_id ? UM.Theme.getColor("favorites_row_selected") : "transparent") : "transparent" - + //color: material != null ? (base.currentItem.root_material_id == material.root_material_id ? UM.Theme.getColor("favorites_row_selected") : "transparent") : "transparent" + color: + { + if(material !== null && base.currentItem !== null) + { + if(base.currentItem.root_material_id === material.root_material_id) + { + return UM.Theme.getColor("favorites_row_selected") + } + } + return "transparent" + } Rectangle { id: swatch