PDA

View Full Version : Paint over childs



SABROG
20th May 2009, 12:37
I have QMainWindow and reimplement paintEvent. When showing modal dialogs i want shade whole main window, how this do on more sites like http://www.crossplatform.ru/ when clicking on screenshots, but i can't find info how to paint over childs (QWidgets).
I would not want to override paintEvent of all childs...

I hear about solution with transparent QWidget (as Layout) and raise()/lower(), but this sounds like as overhead.

P.S.: First picture - original, Second - shaded (what i want), Third - what i have. (i don't have Photoshop and use invert colors on 2nd picture instead shade).

aamer4yu
21st May 2009, 05:30
You can try a trick -
Show your widget in the whole screen with semi transparent color. Now to this widget add a child widget , the dialog. You might have to paint the child window yourself and capture the events too for click , etc.
When shown the effect of background grayed will b applicable.

Another way is to use graphicsView fraemwork. If you add a dialog to a scene and show the scene in a transparent / semi-transparent view, it will also have the same effect :) . It will be easier this way as you can add any QWidget :)

wagmare
21st May 2009, 05:53
i am not sure this will help but did u try fader widget concept ..
http://doc.trolltech.com/qq/qq16-fader.html

SABROG
26th May 2009, 12:34
i am not sure this will help but did u try fader widget concept ..
http://doc.trolltech.com/qq/qq16-fader.html

I wrote in first topic, what this not good solution. What if i want draw something on childs widgets from eventFilter method? I don't think what create Layer-Widget for each childs or subclass paintEvent on all my childs is good.

How this can be, Qt have many features for painting but can't just draw foreground of main window without repaint childs?