Results 1 to 4 of 4

Thread: QLabel auto width?

  1. #1
    Join Date
    Apr 2009
    Posts
    63
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default QLabel auto width?

    If I have a label, how do I specify that I want the label width to be automatically adjusted based on the text I have set? In other words, I want all the text to be visible no matter how much text is there. Thanks.

  2. #2
    Join Date
    Nov 2008
    Location
    Częstochowa/Poland
    Posts
    50
    Thanks
    2
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QLabel auto width?

    You just need to use a layout.

  3. #3
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: QLabel auto width?

    Hi,

    If I do not have a layout I call hide() and show(). Then the label adjusts its width depending on the new text length.

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QLabel auto width?

    try to call adjustSize for that label.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Trouble with QLabel
    By dany_MB in forum Newbie
    Replies: 3
    Last Post: 14th August 2009, 08:21
  2. Auto resize QLabel
    By munna in forum Newbie
    Replies: 12
    Last Post: 6th August 2008, 13:39
  3. Replies: 3
    Last Post: 17th July 2008, 07:43
  4. QLabel ScaledContents ignored by style sheet?
    By WinchellChung in forum Newbie
    Replies: 3
    Last Post: 27th February 2008, 14:50
  5. QLabel - auto font scaling possible?
    By Byngl in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2007, 16:50

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.