mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-16 11:35:55 +08:00
Remove un-needed column component
CURA-8587
This commit is contained in:
parent
aea316799a
commit
62596a42e6
@ -17,86 +17,78 @@ Rectangle
|
|||||||
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
|
||||||
|
|
||||||
Column
|
PackageCardHeader
|
||||||
{
|
{
|
||||||
width: parent.width
|
id: packageCardHeader
|
||||||
|
|
||||||
spacing: 0
|
Item
|
||||||
|
|
||||||
PackageCardHeader
|
|
||||||
{
|
{
|
||||||
id: packageCardHeader
|
id: shortDescription
|
||||||
|
|
||||||
// description
|
anchors.fill: parent
|
||||||
Item
|
|
||||||
|
Label
|
||||||
{
|
{
|
||||||
id: shortDescription
|
id: descriptionLabel
|
||||||
|
width: parent.width
|
||||||
|
property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision.
|
||||||
|
|
||||||
anchors.fill: parent
|
text: packageData.description
|
||||||
|
textFormat: Text.PlainText //Must be plain text, or we won't get onLineLaidOut signals. Don't auto-detect!
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
maximumLineCount: 2
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
visible: text !== ""
|
||||||
|
|
||||||
Label
|
onLineLaidOut:
|
||||||
{
|
{
|
||||||
id: descriptionLabel
|
if(truncated && line.isLast)
|
||||||
width: parent.width
|
|
||||||
property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision.
|
|
||||||
|
|
||||||
text: packageData.description
|
|
||||||
textFormat: Text.PlainText //Must be plain text, or we won't get onLineLaidOut signals. Don't auto-detect!
|
|
||||||
font: UM.Theme.getFont("default")
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
maximumLineCount: 2
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
elide: Text.ElideRight
|
|
||||||
visible: text !== ""
|
|
||||||
|
|
||||||
onLineLaidOut:
|
|
||||||
{
|
{
|
||||||
if(truncated && line.isLast)
|
let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width;
|
||||||
|
if(line.implicitWidth > max_line_width)
|
||||||
{
|
{
|
||||||
let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width;
|
line.width = max_line_width;
|
||||||
if(line.implicitWidth > max_line_width)
|
|
||||||
{
|
|
||||||
line.width = max_line_width;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line.width = line.implicitWidth - fontMetrics.advanceWidth("…"); //Truncate the ellipsis. We're adding this ourselves.
|
|
||||||
}
|
|
||||||
descriptionLabel.lastLineWidth = line.implicitWidth;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
line.width = line.implicitWidth - fontMetrics.advanceWidth("…"); //Truncate the ellipsis. We're adding this ourselves.
|
||||||
|
}
|
||||||
|
descriptionLabel.lastLineWidth = line.implicitWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Label
|
}
|
||||||
{
|
Label
|
||||||
id: tripleDotLabel
|
{
|
||||||
anchors.left: parent.left
|
id: tripleDotLabel
|
||||||
anchors.leftMargin: descriptionLabel.lastLineWidth
|
anchors.left: parent.left
|
||||||
anchors.bottom: descriptionLabel.bottom
|
anchors.leftMargin: descriptionLabel.lastLineWidth
|
||||||
|
anchors.bottom: descriptionLabel.bottom
|
||||||
|
|
||||||
text: "… "
|
text: "… "
|
||||||
font: descriptionLabel.font
|
font: descriptionLabel.font
|
||||||
color: descriptionLabel.color
|
color: descriptionLabel.color
|
||||||
visible: descriptionLabel.truncated && descriptionLabel.text !== ""
|
visible: descriptionLabel.truncated && descriptionLabel.text !== ""
|
||||||
}
|
}
|
||||||
Cura.TertiaryButton
|
Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
id: readMoreButton
|
id: readMoreButton
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: descriptionLabel.bottom
|
anchors.bottom: descriptionLabel.bottom
|
||||||
height: fontMetrics.height //Height of a single line.
|
height: fontMetrics.height //Height of a single line.
|
||||||
|
|
||||||
text: catalog.i18nc("@info", "Read more")
|
text: catalog.i18nc("@info", "Read more")
|
||||||
iconSource: UM.Theme.getIcon("LinkExternal")
|
iconSource: UM.Theme.getIcon("LinkExternal")
|
||||||
|
|
||||||
visible: descriptionLabel.truncated && descriptionLabel.text !== ""
|
visible: descriptionLabel.truncated && descriptionLabel.text !== ""
|
||||||
enabled: visible
|
enabled: visible
|
||||||
leftPadding: UM.Theme.getSize("default_margin").width
|
leftPadding: UM.Theme.getSize("default_margin").width
|
||||||
rightPadding: UM.Theme.getSize("wide_margin").width
|
rightPadding: UM.Theme.getSize("wide_margin").width
|
||||||
textFont: descriptionLabel.font
|
textFont: descriptionLabel.font
|
||||||
isIconOnRightSide: true
|
isIconOnRightSide: true
|
||||||
|
|
||||||
onClicked: Qt.openUrlExternally(packageData.packageInfoUrl)
|
onClicked: Qt.openUrlExternally(packageData.packageInfoUrl)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user