mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-29 16:33:14 +08:00
Simplify the layout of the packageCard
CURA-8561
This commit is contained in:
parent
e44a58b3a3
commit
980cc22529
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user