From 8322a36548c52308db86efc4a2a44b78b8e63272 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 16 Oct 2019 16:59:52 +0200 Subject: [PATCH] Fix some QML warnings in the MaterialsPage --- .../Materials/MaterialsBrandSection.qml | 13 ++++------ .../Preferences/Materials/MaterialsSlot.qml | 2 ++ .../Materials/MaterialsTypeSection.qml | 24 +++++++------------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml index 487c87f07c..5dd68c426f 100644 --- a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml @@ -10,6 +10,8 @@ import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura +// An expandable list of materials. Includes both the header (this file) and the items (brandMaterialList) + Item { id: brand_section @@ -50,9 +52,8 @@ Item verticalAlignment: Text.AlignVCenter leftPadding: (UM.Theme.getSize("default_margin").width / 2) | 0 } - Button + Item { - text: "" implicitWidth: UM.Theme.getSize("favorites_button").width implicitHeight: UM.Theme.getSize("favorites_button").height UM.RecolorImage @@ -67,10 +68,6 @@ Item color: "black" source: brand_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") } - style: ButtonStyle - { - background: Item { } - } } } MouseArea @@ -99,7 +96,7 @@ Item id: brandMaterialList anchors.top: brand_header.bottom width: parent.width - anchors.left: parent.left + anchors.left: parent ? parent.left : undefined height: brand_section.expanded ? childrenRect.height : 0 visible: brand_section.expanded @@ -109,7 +106,7 @@ Item delegate: Loader { id: loader - width: parent.width + width: parent ? parent.width : 0 property var element: model sourceComponent: hasMaterialTypes ? materialsTypeSection : materialSlot } diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index c6691460cf..81bb8759ff 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -10,6 +10,8 @@ import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura +// A single material row, typically used in a MaterialsBrandSection + Rectangle { id: materialSlot diff --git a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml index 3c36e12651..07630a83b4 100644 --- a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml @@ -20,8 +20,8 @@ Item property var expanded: materialList.expandedTypes.indexOf(materialBrand + "_" + materialName) > -1 property var colorsModel: materialType != null ? materialType.colors: null height: childrenRect.height - width: parent.width - anchors.left: parent.left + width: parent ? parent.width :undefined + anchors.left: parent ? parent.left : undefined Rectangle { id: material_type_header_background @@ -55,7 +55,7 @@ Item leftPadding: UM.Theme.getSize("default_margin").width anchors { - left: parent.left + left: parent ? parent.left : undefined } Label { @@ -65,33 +65,25 @@ Item id: material_type_name verticalAlignment: Text.AlignVCenter } - Button + Item // this one causes lots of warnings { - text: "" implicitWidth: UM.Theme.getSize("favorites_button").width implicitHeight: UM.Theme.getSize("favorites_button").height UM.RecolorImage { anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter + verticalCenter: parent ? parent.verticalCenter : undefined + horizontalCenter: parent ? parent.horizontalCenter : undefined } width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height color: "black" source: material_type_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") } - style: ButtonStyle - { - background: Rectangle - { - anchors.fill: parent - color: "transparent" - } - } + } } - MouseArea + MouseArea // causes lots of warnings { anchors.fill: material_type_header onPressed: