Results 1 to 3 of 3

Thread: qdailog qlabel::setpixmap and onresize

  1. #1
    Join Date
    May 2012
    Posts
    57
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default qdailog qlabel::setpixmap and onresize

    I need a qdialog with an image, which needs to respond to resizeevents().
    This is for qt for android so I have to respond to the user rotating the device.
    So I tried a qdialog with a qlabel which has a pixmap.
    So in resizeEvent() I need to redraw the corresponding image, and then use QLabel::setPixmap with the new image again.
    But on setPixmap the onresize is called again. And the dialog gets stuck in an infinite loop.

    Any idea's please? I'm searching for hours now and I'm growing really dumb.

  2. #2
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qdailog qlabel::setpixmap and onresize

    Just give us the code. What you have tried?

  3. #3
    Join Date
    May 2012
    Posts
    57
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: qdailog qlabel::setpixmap and onresize

    I finally found a solution, after much searching I found this tip for qlabel: In order to be able to scale down as well, you need to add this call: label->setMinimumSize(1, 1)

    Before that, when I used qlabel::setpixmap() the pixmap would never scale down anymore, and the resizeevent would always give too large sizes.

    Also in the resizeevent I had to use an image with the exact size of that resolution, else it wouldn't display properly.

    I don't know if these are a android quirks, I cannot duplicate them on the desktop because there is no resizeevent when you rotate your pc sideways.
    Last edited by Cremers; 26th July 2013 at 16:42.

Similar Threads

  1. JPG not working when calling setPixmap() on QLabel
    By Deusdies in forum Qt Programming
    Replies: 2
    Last Post: 25th May 2012, 00:31
  2. QLabel and setPixmap causes flickering
    By roxton in forum Qt Programming
    Replies: 3
    Last Post: 30th August 2010, 10:40
  3. QLabel setPixmap only works twice?
    By December in forum Qt Programming
    Replies: 0
    Last Post: 28th February 2010, 10:59
  4. qlabel can't use setPixmap() function
    By emailhy in forum Qt Programming
    Replies: 1
    Last Post: 24th December 2009, 23:30
  5. QLabel not resize in setPixmap()
    By xgoan in forum Newbie
    Replies: 3
    Last Post: 23rd October 2006, 12:21

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.