Fix a number of QML warnings

This commit is contained in:
Jaime van Kessel 2019-05-16 14:23:09 +02:00
parent 843bb6f5a3
commit bfe1275d46

View file

@ -14,8 +14,11 @@ Item
{ {
id: material_type_section id: material_type_section
property var materialType 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 height: childrenRect.height
width: parent.width width: parent.width
Rectangle Rectangle
@ -23,7 +26,7 @@ Item
id: material_type_header_background id: material_type_header_background
color: color:
{ {
if(!expanded && materialType.brand + "_" + materialType.name == materialList.currentType) if(!expanded && materialBrand + "_" + materialName == materialList.currentType)
{ {
return UM.Theme.getColor("favorites_row_selected") return UM.Theme.getColor("favorites_row_selected")
} }
@ -55,7 +58,7 @@ Item
} }
Label Label
{ {
text: materialType.name text: materialName
height: UM.Theme.getSize("favorites_row").height height: UM.Theme.getSize("favorites_row").height
width: parent.width - parent.leftPadding - UM.Theme.getSize("favorites_button").width width: parent.width - parent.leftPadding - UM.Theme.getSize("favorites_button").width
id: material_type_name id: material_type_name
@ -92,7 +95,7 @@ Item
anchors.fill: material_type_header anchors.fill: material_type_header
onPressed: onPressed:
{ {
const identifier = materialType.brand + "_" + materialType.name; const identifier = materialBrand + "_" + materialName;
const i = materialList.expandedTypes.indexOf(identifier) const i = materialList.expandedTypes.indexOf(identifier)
if (i > -1) if (i > -1)
{ {
@ -135,7 +138,7 @@ Item
return; return;
} }
expanded = materialList.expandedTypes.indexOf(materialType.brand + "_" + materialType.name) > -1 expanded = materialList.expandedTypes.indexOf(materialBrand + "_" + materialName) > -1
} }
} }
} }