Qt World Summit: Submit your Presentation

Say to Qt to never erase a specified widget background

  • Hi all,

    I have a desktop application which have a widget where the handle (p->winId()) is passed to a graphic library in order to draw the content.

    As this widget is the central widget of my main window, when I resize the window, the widget is also resized.

    My problem is that Qt erase the background of the widget.

    • When the widget is resized to a greater size, there is some flickering because Qt erase the background before I receive a WM_PAINT event
    • When the size is smaller, I receive the WM_PAINT event, I draw the content and then, I don't know why, Qt erase it :(

    Can you tel me what can I do ?
    King Regards,

  • You can set the "autoFillBackground":http://doc.qt.nokia.com/4.7/qwidget.html#autoFillBackground-prop property of QWidget to false.

  • It does the same.. :(

  • The only difference is that I only receive the 0X85 - WM_NCPAINT (only when the size is enlarged) but nothing when I reduce it, and the backgroung is still cleared at any resize :'(

  • Have you combined it with attribute: opaquePaintEvent etc?
    Perhaps you have to disable double buffering for the widget etc...

Log in to reply