Small changes in the qml code for the compatibility chart

This commit is contained in:
Diego Prado Gesto 2019-05-07 09:10:28 +02:00
parent c3f3b8dd93
commit 5c3a608e1a

View file

@ -17,18 +17,19 @@ Item
property var materialWebsiteUrl: packageData.links.website property var materialWebsiteUrl: packageData.links.website
height: childrenRect.height height: childrenRect.height
onVisibleChanged: packageData.type == "material" && (compatibilityItem.visible || dataSheetLinks.visible) onVisibleChanged: packageData.type === "material" && (compatibilityItem.visible || dataSheetLinks.visible)
Item Column
{ {
id: compatibilityItem id: compatibilityItem
visible: packageData.has_configs visible: packageData.has_configs
width: parent.width width: parent.width
// This is a bit of a hack, but the whole QML is pretty messy right now. This needs a big overhaul.
height: visible ? heading.height + table.height: 0
Label Label
{ {
id: heading id: heading
anchors.topMargin: UM.Theme.getSize("default_margin").height
width: parent.width width: parent.width
text: catalog.i18nc("@label", "Compatibility") text: catalog.i18nc("@label", "Compatibility")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@ -40,8 +41,6 @@ Item
TableView TableView
{ {
id: table id: table
anchors.top: heading.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height
width: parent.width width: parent.width
frameVisible: false frameVisible: false
@ -122,32 +121,32 @@ Item
TableViewColumn TableViewColumn
{ {
role: "machine" role: "machine"
title: catalog.i18nc("@label table header", "Machine") title: catalog.i18nc("@label:table_header", "Machine")
width: Math.floor(table.width * 0.25) width: Math.floor(table.width * 0.25)
delegate: columnTextDelegate delegate: columnTextDelegate
} }
TableViewColumn TableViewColumn
{ {
role: "print_core" role: "print_core"
title: catalog.i18nc("@label table header", "Print Core") title: catalog.i18nc("@label:table_header", "Print Core")
width: Math.floor(table.width * 0.2) width: Math.floor(table.width * 0.2)
} }
TableViewColumn TableViewColumn
{ {
role: "build_plate" role: "build_plate"
title: catalog.i18nc("@label table header", "Build Plate") title: catalog.i18nc("@label:table_header", "Build Plate")
width: Math.floor(table.width * 0.225) width: Math.floor(table.width * 0.225)
} }
TableViewColumn TableViewColumn
{ {
role: "support_material" role: "support_material"
title: catalog.i18nc("@label table header", "Support") title: catalog.i18nc("@label:table_header", "Support")
width: Math.floor(table.width * 0.225) width: Math.floor(table.width * 0.225)
} }
TableViewColumn TableViewColumn
{ {
role: "quality" role: "quality"
title: catalog.i18nc("@label table header", "Quality") title: catalog.i18nc("@label:table_header", "Quality")
width: Math.floor(table.width * 0.1) width: Math.floor(table.width * 0.1)
} }
} }
@ -156,7 +155,7 @@ Item
Label Label
{ {
id: dataSheetLinks id: dataSheetLinks
anchors.top: parent.top anchors.top: compatibilityItem.bottom
anchors.topMargin: UM.Theme.getSize("narrow_margin").height anchors.topMargin: UM.Theme.getSize("narrow_margin").height
visible: base.technicalDataSheetUrl !== undefined || visible: base.technicalDataSheetUrl !== undefined ||
base.safetyDataSheetUrl !== undefined || base.safetyDataSheetUrl !== undefined ||