Don't show elision or read more if there is no description at all

Apparently Qt marks it as 'truncated' then, even though it's not really. Don't show the ... nor the 'read more' button if there is nothing more to read.

Contributes to issue CURA-8565.
This commit is contained in:
Ghostkeeper 2021-11-29 19:59:43 +01:00
parent d0eee2cffe
commit f385e3d639
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -239,6 +239,7 @@ Rectangle
maximumLineCount: 2 maximumLineCount: 2
wrapMode: Text.Wrap wrapMode: Text.Wrap
elide: Text.ElideRight elide: Text.ElideRight
visible: text !== ""
onLineLaidOut: onLineLaidOut:
{ {
@ -267,7 +268,7 @@ Rectangle
text: "… " text: "… "
font: descriptionLabel.font font: descriptionLabel.font
color: descriptionLabel.color color: descriptionLabel.color
visible: descriptionLabel.truncated visible: descriptionLabel.truncated && descriptionLabel.text !== ""
} }
Cura.TertiaryButton Cura.TertiaryButton
{ {
@ -279,7 +280,7 @@ Rectangle
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 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