PDA

View Full Version : How to paint across/over multiple widgets?



richy
30th August 2006, 23:16
I have a main display widget that has one standard grid layout managing multiple child widgets.

How do I paint (overlay) across all the child widgets?

(Currently, as a work aroud I'm just using a dummy borderless widget with masked pixmap background on top... but I like to be able to blindly paint over all the widgets)

-r.

wysota
30th August 2006, 23:36
I don't think there is an easy way of doing that in Qt3. The easiest way is probably to install an event filter on all child widgets of a parent widget and draw there.

richy
31st August 2006, 00:18
Yes -- capturing (overriding) the child widgets paintEvent and drawing over existing pixmap is straight forward enough.

But I would like to draw a single banner covering all or some of the child widgets.

For example, lets say it's a client/server app, and the server has discounnected..
I would like to paint a big text/sign warning that says "TIMEOUT: DISCONNECTED" across the main display.. and in this case the main display is a layout with many child widgets...

-r.

wysota
31st August 2006, 11:57
You can use the same mechanism. In event filter you should force the paint event of child widget and then paint over the result. I guess it would be much easier with Qt4.