Hello all,
Sorry in advance if this question has an obvious answer, or if it's already been answered to death on forums. I spent a considerable amount of time and effort trying to find an answer, without luck.
For some reason, the (top level) windows of my application all seem to have a white background. Usually, it isn't noticeable (and isn't a problem, possibly apart from a small performance hit), but there are two situations where it appears and gets annoying:
1. When I resize a window by dragging its top or left borders (and only those), the content of the window is drawn with a slight lag, and the white background appears briefly on the bottom (respectively right) side the window, filling the gap created by the resizing.
2. More annoyingly, when I call show() or showNormal() on a top level window that has been previously hidden, there is a very noticeable and distracting white flash, before the content of the window is rendered. If I delay the program execution a few seconds, right after the call to show() or showNormal(), I can confirm that the window first appears completely white, and only after that its content gets rendered on top (when a paint event gets processed?). Note that this white background *does not* appear when a window is show()'ed for the first time after it was created, it only shows when the window was first hidden (using hide() or close()) and then showed again (using show() or showNormal()).
Two additional notes: (1) the entire app is styled using stylesheets (and only stylesheets); (2) all my windows inherit from QWidget.
I have tried many things (and possibly many nonsensical ones, in despair) to either get rid of the white background altogether, or make it transparent, or hide the double draw, but none of them worked:
- calling setAttribute(Qt::WA_NoSystemBackground) in the constructor of my window
- calling setAutoFillBackground(false) (but IIRC this is the default) in the window ctor
- wrapping the window->showNormal() call with setUpdatesEnabled(false) and setUpdatesEnabled(true)
- replacing window->showNormal() by window->showMinimized() followed by window->raise()
- moving the window to (-10000, -10000) before calling showNormal(), then moving it back to its original position
- etc.
I'm using Qt 4.5.2 on Windows Vista SP1.
Thanks for your help.
Cheers,
Franz
Bookmarks