Qt / QML - Choose how many characters to be displayed in a Text item -
i display 2 first characters of word in text item. example, have list of words (french, english, italian) , display (fr, en, it).
if elide text, 3 dots (...) @ end , don't want that.
any ideas ?
thanks in advance
you set clip true need play width.
so think best option implement little function in javascript first 2 letters.
example:
main.qml
import qtquick 2.5 import qtquick.window 2.2 import "myscript.js" myfunctions window { visible: true // need play width text { width: 13 text: "french" clip: true } // ok. width not necessary text { y: 60 text: myfunctions.substring("french") } // don't want behaviour text { y: 30 width: 25 text: "french" elide: text.elideright } } myscript.js
function substring(str) { return str.substring(0, 2); }
Comments
Post a Comment