How to elide text in TextEdit



  • 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-te...tml#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)
    • after last line uncommented I see text only at first column in my table. Yes, text is elided but only in one way

    I cannot find how to attach screenshots (you can get it here http://www.qtcentre.org/threads/65095-How-to-elide-text-in-TextEdit)



  • This post is deleted!

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.