[Qt-interest] QWidget Not being laid out correctly after resizing

Mike Jackson imikejackson at gmail.com
Fri Apr 24 20:48:01 CEST 2009


On 2009-04-24 14:16:11 -0400, Mike Jackson <imikejackson at gmail.com> said:

> I am using a QWidget derived class to do some custom drawing of images. 
> One image is the base and another image is the "movable" image where 
> the use can drag it around in order to align the bottom image with the 
> top image. I am using the QPainter::CompositionMode_Exclusion to allow 
> the 2 images to be "seen" simultaneously. The custom QWidget is 
> embedded in another QWidget which is in a QScrollArea. For the most 
> part this is working well but the problem occurs when the user uses 
> some UI features to "resize" the bottom image. (Behind the scenes new 
> data is read from disk and the appropriate region of interest is 
> extracted and turned into a QImage). The problem is that the "Image" 
> jumps to the upper left of the enclosing QWidget instead of being 
> rendered in the center of the QWidget like normal. As soon as I 
> manually resize the window any amount the new image will jump back to 
> the center of the QWidget.
> 
>   What might be causing this to happen?
> 
> Thanks
> Mike Jackson

I Figured out that I needed a call to "updateGeometry()" which fixed 
that problem.

Mike




More information about the Qt-interest-old mailing list