PDA

View Full Version : Draw an image as background at the erase background time (and not paint time)



kinju
25th June 2010, 18:18
Hello everyone,

I have a big big problem.

When I receive the WM_ERASEBKGND message, I need to take make some operation to build an image in order to put it as a background of my widget.

The problem is that the background is grey during the time I'm building the image. So, when the user resize the window, my widget wink and it's not beautiful.

So I would like to know if I could capture the WM_ERASEBKGND event, build the image and do something for making Qt use it when it's making the erase background operation ?

Thank you very muck :)

Aurélien

tbscope
25th June 2010, 18:31
First things first: without doing some magic voodoo, Qt can only paint on widgets inside the paint event.

With that in mind, you know that you will always need to paint the background from within the paint event.

Flickering of the background can be solved by making use of double buffering.
http://doc.trolltech.com/qq/qq06-flicker-free.html