Qt World Summit: Register Today!

Paint problem while showing QDockWidget

  • Hi,

    I am facing the problem with the dockwidget where whenever i am resizing i am seeing this weird painting effects. The screenshot will help you more in that perspect. I have these four attributes in dockwidget constructor:-

    setWindowFlags( windowFlags() | Qt::FramelessWindowHint );
    setAttribute( Qt::WA_TranslucentBackground );
    setAttribute( Qt::WA_NoSystemBackground, false );
    setFloating( true );

    I can see the problem only when i set floating to true. But i need floating to true otherwise the transparency will not work. Please help me in this regards.


  • I don't know if this is related or not but I have also seen problems with QDocWidget when floating. In my case it was only a problem on OS X (10.10, Qt 5.6.0 XCode 7). My solution was to not allow the QDockwidget to float on OS X (okay on GNU/Linux and Windows).

    I didn't see any odd painting effects but instead it didn't paint at all (60% of the time). Even though it didn't draw the control everything seemed to work. If I clicked on a location where a button should have been drawn it would react correctly. If I resized the QDockWidget while floating it would re-draw itself correctly (most of the time).

    You didn't mention what version of Qt or which OS you are using. It sounds like it is along the same lines as what I experienced. I dug into it a bit but I didn't require a floating QDocWidget for that particular program so I simply disabled that option on OS X.

    If none of this matches what you have then this is just a coincidence I assume.

  • @Rondog Thanks for the reply. I am using Qt 5.6.2 in Windows 7 x64. BTW i am doing setFloating(true) because i need transparency effect in dockwidget which is not working if i keep it as false. However, I am able to fix this problem by setting content widget parent to parentWidget().

Log in to reply