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

Mike Jackson imikejackson at gmail.com
Fri Apr 24 20:16:11 CEST 2009


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




More information about the Qt-interest-old mailing list