Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Bug created] Elide plain text in a QTextDocument?
QtWS25 Last Chance

[Bug created] Elide plain text in a QTextDocument?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    How do I configure a QTextDocument to elide plain text?

    I.e. If the text is too long, I'd like to see something like

    "This is a ridi...line of text".

    1 Reply Last reply
    0
    • S Offline
      S Offline
      ScottR
      wrote on last edited by
      #2

      QFontMetrics::elidedText() should do what you want.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        I have discussed this issue with Qt support. The result is this QTBUG (well, it's a suggestion, but they are all called "QTBUG"):

        "QTBUG":https://bugreports.qt-project.org/browse/QTBUG-34857

        The code is there in QFontMetrics, there's just no way to make use of it in a QTextDocument in any sensible way.

        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