From bfe1275d4630f63d0ef0e9c99e7620f4515e6a40 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 May 2019 14:23:09 +0200 Subject: [PATCH] Fix a number of QML warnings --- .../Materials/MaterialsTypeSection.qml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml index b5054591c0..2c1e2128e1 100644 --- a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml @@ -14,8 +14,11 @@ Item { id: material_type_section property var materialType - property var expanded: materialList.expandedTypes.indexOf(materialType.brand + "_" + materialType.name) > -1 - property var colorsModel: materialType.colors + + property string materialBrand: materialType != null ? materialType.brand : "" + property string materialName: materialType != null ? materialType.name : "" + property var expanded: materialList.expandedTypes.indexOf(materialBrand + "_" + materialName) > -1 + property var colorsModel: materialType != null ? materialType.colors: null height: childrenRect.height width: parent.width Rectangle @@ -23,7 +26,7 @@ Item id: material_type_header_background color: { - if(!expanded && materialType.brand + "_" + materialType.name == materialList.currentType) + if(!expanded && materialBrand + "_" + materialName == materialList.currentType) { return UM.Theme.getColor("favorites_row_selected") } @@ -55,7 +58,7 @@ Item } Label { - text: materialType.name + text: materialName height: UM.Theme.getSize("favorites_row").height width: parent.width - parent.leftPadding - UM.Theme.getSize("favorites_button").width id: material_type_name @@ -92,7 +95,7 @@ Item anchors.fill: material_type_header onPressed: { - const identifier = materialType.brand + "_" + materialType.name; + const identifier = materialBrand + "_" + materialName; const i = materialList.expandedTypes.indexOf(identifier) if (i > -1) { @@ -135,7 +138,7 @@ Item return; } - expanded = materialList.expandedTypes.indexOf(materialType.brand + "_" + materialType.name) > -1 + expanded = materialList.expandedTypes.indexOf(materialBrand + "_" + materialName) > -1 } } } \ No newline at end of file