Quote Originally Posted by moowy
Somehow this doesn't do the trick. I already have installed an eventFilter(paint event) on the qdockwidget and I applied the code to it but it doesn't show. Any other ideas??
Painting in an event filter is a bit problematic because the event goes FIRST through the filter and THEN to the base class (assuming that the event filter doesn't filter it out). So basically the base class draws over anything you had drawn in the event filter. This kind of painting is possible in event filter only by doing some ugly tricks. Basically you have to deliver the event to the receiver widget by hand and then do the custom painting afterwards. And you will also have to temporarily remove the event filter to avoid an infinite loop.

Qt Code:
  1. // this is inside an event filter where event type is a paint event..
  2.  
  3. // remove the event filter during sending
  4. // the paint event to avoid an infinite loop
  5. widget->removeEventFilter(this);
  6.  
  7. // send the event and let the widget to draw itself first
  8. QApplication::sendEvent(widget, event);
  9.  
  10. // restore the event filter
  11. widget->installEventFilter(this);
  12.  
  13. // draw your custom things here
  14. QStylePainter painter(widget);
  15. ....
  16.  
  17. // be sure to return true so that the widget doesn't
  18. // receive this paint event and paint itself over again
  19. return true;
To copy to clipboard, switch view to plain text mode 

So, I recommend you to simply subclass QDockWidget and override paintEvent()... it will be much simplier and less error prone..