Reputation: 13
I have a text which is displayed in multiple lines and I need elide to happen for a line when the width of the text is exceeded. Please find the code below that I have now.
Code:
Text {
width: 500
maximumLineCount: 3
horizontalAlignment: "AlignHCenter"
wrapMode: Text.WordWrap//"WordWrap"
elide:Text.ElideRight
text:"Firstline\nstart_kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk_end" color: "red" }
Now for me on line 1: "First line" appears and on 2nd line the remaining text appears without any eliding effect(i.e complete text is shown). It appears the following way: "Firstline start_kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk_end" I want eliding to happen at 2nd line as it exceeds the width.
Thanks in advance
Upvotes: 0
Views: 1699
Reputation: 8484
According to documentation:
If this property is set to Text.ElideRight, it can be used with wrapped text. The text will only elide if maximumLineCount, or height has been set. If both maximumLineCount and height are set, maximumLineCount will apply unless the lines do not fit in the height allowed.
So the text will elide either if you add second line before, like:
text: "First line \nSecond line \nkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
or
if maximumLineCount
will be set to 2 lines:
maximumLineCount: 2
Upvotes: 2