Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
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?
Qt 6.12 LTS is out! See what's new in the release blog

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 2.1k 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.
  • ? Offline
    ? Offline
    A Former User
    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.

    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
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

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

        Thanks, Andre!

        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
        • Unsolved