View Full Version : Widget paint artefacts on MdiSubwindow

4th May 2012, 02:01

I have an QMainWindow application whose central widget is a MdiArea displaying MdiSubWindows. Each subwindow contains a widget which repaints itself every second. The widget draws a pixmap by setting the WA_PaintOutsidePaintEvent to true (simple example code attached). The code presented is a simplification of a much larger application in which many such pixmaps appear and it would be expensive to use update (ie paint event) to update only a few pixmaps.


if I overlay two of the subwindows the pixmap for the bottom subwindow shows up in the top sub window


I'm trying to determine if this is a bug or if my coding is incorrect. Both 4.7.4 and 4.8.1 show the same behaviour.

Any ideas or suggestion would be very appreciated.

9th May 2012, 14:30
It works for me using Qt 4.6.x on Ubuntu 10.04.
It may be bug introduced in 4.7.x+ but I can't test it at the moment.

Also, I disagree that it would be expensive to paint only some of those pixmaps using paint event.
Clipping should remove all the overhead you may encounter.

You could also trigger update() slot only on those you want to update, instead on all of them.
Just put the drawing in the paint event, and connect your timer to update() and you will get the same result via proper channels (actually, in your example you don't have to connect anything, but I assume that in your project pixmap changes while it's visible and should be repainted).