Results 1 to 2 of 2

Thread: QLabel - auto font scaling possible?

  1. #1
    Join Date
    Mar 2006
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default QLabel - auto font scaling possible?

    Is it possible to get a QLabel to automatically increase the size of the font so the text in the label occupies as much of the available space as possible (Ã la scaledContents for pixmaps)? I've attached some images to illustrate what I mean.

    Start.png - the starting point
    Desired.png - what I'd like to see
    Actual.png - what I'm actually seeing

    Perhaps I should be using something other than QLabel?
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: QLabel - auto font scaling possible?

    No, but if you want to display a simple text only, you can create your own QWidget subclass that will calculate the font size based on the widget size and draw the text accordingly.

Similar Threads

  1. Auto resize QLabel
    By munna in forum Newbie
    Replies: 12
    Last Post: 6th August 2008, 13:39
  2. changing QLabel font size(label created on the graphicsView)
    By maverick_pol in forum Qt Programming
    Replies: 11
    Last Post: 17th August 2007, 08:36
  3. QLabel, large, rich text, font size
    By TheKedge in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2007, 11:56


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.