mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-29 23:03:13 +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
|
property var packageData
|
||||||
|
|
||||||
width: parent ? parent.width - UM.Theme.getSize("thin_margin").width : 0
|
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")
|
color: UM.Theme.getColor("main_background")
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
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.
|
Image //Separate column for icon on the left.
|
||||||
{
|
{
|
||||||
Layout.preferredWidth: UM.Theme.getSize("card_icon").width
|
id: packageItem
|
||||||
Layout.preferredHeight: UM.Theme.getSize("card_icon").height
|
anchors
|
||||||
Layout.alignment: Qt.AlignTop
|
{
|
||||||
|
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"
|
source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
Layout.fillWidth: true
|
anchors
|
||||||
Layout.alignment: Qt.AlignTop
|
{
|
||||||
|
top: parent.top
|
||||||
|
left: packageItem.right
|
||||||
|
right: parent.right
|
||||||
|
margins: UM.Theme.getSize("thin_margin").width
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout //Title row.
|
RowLayout //Title row.
|
||||||
{
|
{
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
spacing: UM.Theme.getSize("thin_margin").width
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
|
|
||||||
text: packageData.displayName
|
text: packageData.displayName
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
color: UM.Theme.getColor("text")
|
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
|
Control
|
||||||
{
|
{
|
||||||
width: UM.Theme.getSize("card_tiny_icon").width
|
Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width
|
||||||
height: UM.Theme.getSize("card_tiny_icon").height
|
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
|
||||||
Layout.alignment: Qt.AlignTop
|
//width: UM.Theme.getSize("card_tiny_icon").width
|
||||||
|
//height: UM.Theme.getSize("card_tiny_icon").height
|
||||||
|
|
||||||
enabled: packageData.isVerified
|
enabled: packageData.isVerified
|
||||||
visible: packageData.isVerified
|
visible: packageData.isVerified
|
||||||
@ -128,10 +127,9 @@ Rectangle
|
|||||||
|
|
||||||
Control
|
Control
|
||||||
{
|
{
|
||||||
width: UM.Theme.getSize("card_tiny_icon").width
|
Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width
|
||||||
height: UM.Theme.getSize("card_tiny_icon").height
|
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
|
||||||
enabled: false // remove!
|
enabled: false // remove!
|
||||||
visible: false // replace packageInfo.XXXXXX
|
visible: false // replace packageInfo.XXXXXX
|
||||||
// TODO: waiting for materials card implementation
|
// TODO: waiting for materials card implementation
|
||||||
@ -152,16 +150,13 @@ Rectangle
|
|||||||
|
|
||||||
// onClicked: Qt.openUrlExternally( XXXXXX ) // TODO
|
// onClicked: Qt.openUrlExternally( XXXXXX ) // TODO
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
|
|
||||||
text: packageData.packageVersion
|
text: packageData.packageVersion
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.SimpleButton
|
UM.SimpleButton
|
||||||
@ -184,8 +179,6 @@ Rectangle
|
|||||||
{
|
{
|
||||||
id: downloadCountRow
|
id: downloadCountRow
|
||||||
|
|
||||||
width: childrenRect.width
|
|
||||||
height: childrenRect.height
|
|
||||||
x: UM.Theme.getSize("thin_margin").width
|
x: UM.Theme.getSize("thin_margin").width
|
||||||
y: UM.Theme.getSize("thin_margin").height
|
y: UM.Theme.getSize("thin_margin").height
|
||||||
|
|
||||||
@ -337,7 +330,6 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FontMetrics
|
FontMetrics
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user