mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 13:17:51 -06: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
1 changed files with 10 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue