Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to elide text in TextEdit
Forum Updated to NodeBB v4.3 + New Features

How to elide text in TextEdit

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qyrychen95
    wrote on last edited by
    #1

    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)

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qyrychen95
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved