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. What is the Qt equivalent for AutoEllipsis on a QLabel?
Forum Updated to NodeBB v4.3 + New Features

What is the Qt equivalent for AutoEllipsis on a QLabel?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 4.8k 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.
  • B Offline
    B Offline
    bs55
    wrote on last edited by bs55
    #1

    I want my label to trim the text and add an ellipsis (…) when the text become to long but I cannot find this setting Qt.

    Example:

    myLabel->setText("Short text");
    result: Short text
    
    myLabel->setText("Long text with plenty of letters");
    result: Long text with ple…
    
    aha_1980A 1 Reply Last reply
    1
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Don't think this option exist. You need to customise it. There is an example in the Qt Examples directory which is on similar line.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      5
      • B bs55

        I want my label to trim the text and add an ellipsis (…) when the text become to long but I cannot find this setting Qt.

        Example:

        myLabel->setText("Short text");
        result: Short text
        
        myLabel->setText("Long text with plenty of letters");
        result: Long text with ple…
        
        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @bs55: as @dheerendra said, there is an example:

        http://doc.qt.io/qt-5/qtwidgets-widgets-elidedlabel-example.html

        Qt has to stay free or it will die.

        1 Reply Last reply
        3

        • Login

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