mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-04 05:45:12 +08:00
Truncate double ellipsis where possible
I couldn't get it to truncate it if the double ellipsis is the only text on the line, like if the description contains a white line and more than 2 lines in total. It then looks like a double ellipsis (6 dots instead of 3). Doesn't look the worst, but a bit strange, but it's really difficult to fix. Contributes to issue CURA-8561.
This commit is contained in:
parent
7b7cb43b02
commit
5a698bd91f
@ -123,8 +123,15 @@ Rectangle
|
||||
{
|
||||
if(truncated && line.isLast)
|
||||
{
|
||||
line.width = Math.min(line.implicitWidth,
|
||||
parent.width - readMoreButton.width - fontMetrics.advanceWidth("… "));
|
||||
let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ");
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -150,7 +157,7 @@ Rectangle
|
||||
|
||||
Label
|
||||
{
|
||||
text: "... "
|
||||
text: "… "
|
||||
visible: descriptionLabel.truncated
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: descriptionLabel.lastLineWidth
|
||||
|
Loading…
x
Reference in New Issue
Block a user