Qyrychen
3rd February 2016, 12:22
hi All!
There is Qml model and TableView in my application.
TextEdit is used in delegate for text displaying (I use this element because I will use QSyntaxHighlighter with it)
Also I use wrapMode: Text.NoWrap
After column width changing I want get elide string (like ThisIsATex... for example)
I use TextMetrics for text eliding (http://doc.qt.io/qt-5/qml-qtquick-textmetrics.html#width-prop)
onWidthChanged: {
textMetrics.text = delegateTextEdit.text
textMetrics.elideWidth = delegateTextEdit.width - 10
var str = textMetrics.elidedText
console.debug(str)
//delegateTextEdit.text = str
}
Problem:
- on width changing I can see correct elide text in console (in TableView it doesn't appear)
11675
- after last line uncommented I see text only at first column in my table. Yes, text is elided but only in one way
11676
There is Qml model and TableView in my application.
TextEdit is used in delegate for text displaying (I use this element because I will use QSyntaxHighlighter with it)
Also I use wrapMode: Text.NoWrap
After column width changing I want get elide string (like ThisIsATex... for example)
I use TextMetrics for text eliding (http://doc.qt.io/qt-5/qml-qtquick-textmetrics.html#width-prop)
onWidthChanged: {
textMetrics.text = delegateTextEdit.text
textMetrics.elideWidth = delegateTextEdit.width - 10
var str = textMetrics.elidedText
console.debug(str)
//delegateTextEdit.text = str
}
Problem:
- on width changing I can see correct elide text in console (in TableView it doesn't appear)
11675
- after last line uncommented I see text only at first column in my table. Yes, text is elided but only in one way
11676