Solved How to cut off text using QML Text element?
-
Hi,
I think i'm overlooking something because there has to be a simple solution for my problem.
I have a text element:
@
Text {
text : "veryloonnnnnnnnnnnnnnggggggggggggggggggggggggtext"
width: 100
}
@How can I "cut off" the text so everything over width 100 won't be visible ( so only "verylon" or something will be shown ) ?
-
If you set clip:true on the text item, the element will not draw outside of it rectangular bounds. Alternatively, if you want the text to use elipsis (...) you can set the text elide mode to tell it how to crop the text to fit.
-
Thanks a lot Jens, I have used the clip property of text element to "cut off" the text!
I have tried elide before but it didn't cut the tex on the right side..
-
Use:
elide: Text.ElideRight
:) -
Mark the subject as solved.