Important: Please read the Qt Code of Conduct -

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 (

        onWidthChanged: {
                                textMetrics.text = delegateTextEdit.text
                                textMetrics.elideWidth = delegateTextEdit.width - 10
                                var str = textMetrics.elidedText
                                //delegateTextEdit.text = str


    • 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

  • This post is deleted!

Log in to reply