Results 1 to 20 of 20

Thread: White background in window, getting desperate!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    49
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default White background in window, getting desperate!

    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
    Last edited by dictoon; 28th December 2009 at 20:32.

Similar Threads

  1. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 20:11
  2. Replies: 2
    Last Post: 9th August 2009, 22:08
  3. Window Background
    By QbelcorT in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 23rd September 2008, 06:03
  4. Background image for main window widget using css.
    By Enygma in forum Qt Programming
    Replies: 8
    Last Post: 23rd August 2007, 15:40
  5. Replies: 15
    Last Post: 23rd March 2007, 16:16

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.