PDA

View Full Version : qdailog qlabel::setpixmap and onresize



Cremers
26th July 2013, 10:32
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.

Gokulnathvc
26th July 2013, 14:32
Just give us the code. What you have tried?

Cremers
26th July 2013, 16:13
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. :)