Results 1 to 2 of 2

Thread: QLabel to scale a graphic

  1. #1
    Join Date
    Apr 2008
    Posts
    45
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QLabel to scale a graphic

    I am trying to use a QLabel to display a pixmap. I want to be able to have it stretch and shrink as the window is resized. With text, it works normally.

    But when I set a pixmap and scaledContents = true, then it doesn't respect the aspect ratio.
    What's worse is when I scale the pixmap to maintain the aspect ratio, you can't shrink it.

    Anyone know how I can do this using a standard QLabel?

    Thanks!

  2. #2
    Join Date
    Apr 2008
    Posts
    45
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QLabel to scale a graphic

    Doh. I got it.

    You need to set minimumSize, else minimumSize=currentSize and it never gets smaller!

Similar Threads

  1. Trouble with QLabel
    By dany_MB in forum Newbie
    Replies: 3
    Last Post: 14th August 2009, 08:21
  2. Replies: 3
    Last Post: 17th July 2008, 07:43
  3. Replies: 13
    Last Post: 12th June 2008, 13:23
  4. QLabel ScaledContents ignored by style sheet?
    By WinchellChung in forum Newbie
    Replies: 3
    Last Post: 27th February 2008, 14:50
  5. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57

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.