Results 1 to 4 of 4

Thread: QLabel text and ElideMode (...)

  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QLabel text and ElideMode (...)

    Hello,
    Is it possible to somehow set elide mode for text in QLabels?
    I have a lot of text (path with filename) that are displayed, and I wonder if it is possible to i.e. show instead of
    "/home/username/workfiles/year2010/works/may/19/filename.jpg"
    something like:
    ".../works/may/19/filename.jpg"

    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QLabel text and ElideMode (...)

    See QxtLabel or do it yourself...

  3. The following user says thank you to Lykurg for this useful post:

    Talei (8th May 2010)

  4. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QLabel text and ElideMode (...)

    You can get the eldied text via QFontMetrics::elidedText and set it on the label
    Or alternatively you can subclass QLabel, override the setText function and set elided text from that function.

  5. The following user says thank you to aamer4yu for this useful post:

    Talei (8th May 2010)

  6. #4
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QLabel text and ElideMode (...)

    Thank you,
    QxtLabel also use QFontMetrics so I kind of figure it out yesterday.

    Regards

Similar Threads

  1. Replies: 1
    Last Post: 1st February 2010, 02:01
  2. Position of text in a qlabel
    By jiveaxe in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2008, 13:26
  3. How to right-justify QLabel text
    By JimDaniel in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2008, 08:55
  4. Squeeze text in QLabel
    By jiveaxe in forum Qt Programming
    Replies: 5
    Last Post: 6th September 2007, 10:45
  5. Qlabel with (icon and text) HowTo ?
    By QiT in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2006, 08:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.