PDA

View Full Version : graying out window?



drkbkr
19th March 2007, 15:45
Hi,

I'm wondering if people have good ways to gray out an entire window. I'd like my entire main window to appear grayed out when a dialog is active (to further emphasize that the window is inactive and can't be used), then come back to normal when the dialog is dismissed.

I was thinking of just laying a big QPixmap filled with semi transparent white over the whole thing, but I don't know that that is the best idea.

Any comments or help would be appreciated.

Thanks,
Derek

jpn
19th March 2007, 15:58
How about QWidget::setDisabled() (http://doc.trolltech.com/4.2/qwidget.html#enabled-prop)?

drkbkr
19th March 2007, 16:59
I had thought of that and dismissed it since any custom drawn widget (which most of them are) would have to have additional code added to know what to do when it was disabled.

If there's no easier way that's fine, I was just hoping someone else had experience with something quicker.

Thanks for the reply.
Derek

jpn
19th March 2007, 17:04
I had thought of that and dismissed it since any custom drawn widget (which most of them are) would have to have additional code added to know what to do when it was disabled.
Yeah, custom widgets should take their own state into account and choose the correct palette color group (active, inactive, normal, disabled) while painting controls.