Simplify the layout of the packageCard

CURA-8561
This commit is contained in:
Jaime van Kessel 2021-11-16 18:02:56 +01:00
parent e44a58b3a3
commit 980cc22529

View File

@ -13,7 +13,7 @@ Rectangle
property var packageData
width: parent ? parent.width - UM.Theme.getSize("thin_margin").width : 0
height: childrenRect.height
height: childrenRect.height + UM.Theme.getSize("thin_margin").height * 2
color: UM.Theme.getColor("main_background")
radius: UM.Theme.getSize("default_radius").width
@ -52,53 +52,52 @@ Rectangle
}
]
RowLayout
{
width: parent.width - UM.Theme.getSize("thin_margin").width * 2
height: childrenRect.height + UM.Theme.getSize("thin_margin").height * 2
x: UM.Theme.getSize("thin_margin").width
y: UM.Theme.getSize("thin_margin").height
spacing: UM.Theme.getSize("default_margin").width
Image //Separate column for icon on the left.
{
Layout.preferredWidth: UM.Theme.getSize("card_icon").width
Layout.preferredHeight: UM.Theme.getSize("card_icon").height
Layout.alignment: Qt.AlignTop
id: packageItem
anchors
{
top: parent.top
left: parent.left
margins: UM.Theme.getSize("thin_margin").width
}
width: UM.Theme.getSize("card_icon").width
height: width
source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg"
}
Column
{
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
anchors
{
top: parent.top
left: packageItem.right
right: parent.right
margins: UM.Theme.getSize("thin_margin").width
}
RowLayout //Title row.
{
Layout.alignment: Qt.AlignTop
width: parent.width
spacing: UM.Theme.getSize("thin_margin").width
Label
{
Layout.alignment: Qt.AlignTop
text: packageData.displayName
font: UM.Theme.getFont("medium_bold")
color: UM.Theme.getColor("text")
verticalAlignment: Text.AlignTop
}
Row //Row inside row, but the non-layout version skips invisible elements.
{
spacing: parent.spacing
Layout.alignment: Qt.AlignTop
Control
{
width: UM.Theme.getSize("card_tiny_icon").width
height: UM.Theme.getSize("card_tiny_icon").height
Layout.alignment: Qt.AlignTop
Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
//width: UM.Theme.getSize("card_tiny_icon").width
//height: UM.Theme.getSize("card_tiny_icon").height
enabled: packageData.isVerified
visible: packageData.isVerified
@ -128,10 +127,9 @@ Rectangle
Control
{
width: UM.Theme.getSize("card_tiny_icon").width
height: UM.Theme.getSize("card_tiny_icon").height
Layout.alignment: Qt.AlignTop
Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
Layout.alignment: Qt.AlignCenter
enabled: false // remove!
visible: false // replace packageInfo.XXXXXX
// TODO: waiting for materials card implementation
@ -152,16 +150,13 @@ Rectangle
// onClicked: Qt.openUrlExternally( XXXXXX ) // TODO
}
}
Label
{
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
text: packageData.packageVersion
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
Layout.fillWidth: true
}
UM.SimpleButton
@ -184,8 +179,6 @@ Rectangle
{
id: downloadCountRow
width: childrenRect.width
height: childrenRect.height
x: UM.Theme.getSize("thin_margin").width
y: UM.Theme.getSize("thin_margin").height
@ -337,7 +330,6 @@ Rectangle
}
}
}
}
FontMetrics
{