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. Is there a way to query if the text in a QLineEdit is truncated?
Forum Updated to NodeBB v4.3 + New Features

Is there a way to query if the text in a QLineEdit is truncated?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    miroslav
    wrote on last edited by
    #1

    Hi,

    I need to show tooltips differently depending on whether the text in a QLineEdit is shown fully or truncated. Is there a way to tell from the outside which is the case?

    Thanks!

    Mirko.

    Mirko Boehm | mirko@kde.org | KDE e.V.
    FSFE Fellow
    Qt Certified Specialist

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      I know of no other way than to use QFontMetrics with the font and text of the QTextEdit to get the size, and compare that to the size of the line edit's usable area for showing content.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        miroslav
        wrote on last edited by
        #3

        Hm, this hack is exactly what I was trying not to do. It might work, though.

        Thanks, Andre!

        Mirko Boehm | mirko@kde.org | KDE e.V.
        FSFE Fellow
        Qt Certified Specialist

        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