Fix some QML warnings in the MaterialsPage

This commit is contained in:
Nino van Hooff 2019-10-16 16:59:52 +02:00
parent 86ff7443cf
commit 8322a36548
3 changed files with 15 additions and 24 deletions

View file

@ -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
}

View file

@ -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

View file

@ -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: