PDA

View Full Version : QWidget setMask fully transparent.



bunjee
6th August 2009, 10:20
Hey guys,

I want to apply a fully transparent mask to a QWidget.

I tried the following:


setMask(QRect(0, 0, 0, 0)); // Doesn't work

and this:


setMask(QRect(-1, -1, 1, 1)); // Does work

How am I supposed to set a fully transparent mask to a widget ?

Thanks.

yogeshgokul
6th August 2009, 10:25
Use either full transparent .png image. Or use Qt::transparent. See the docs, this is very easy.
I think full transparent mask is of no use.
Use:

QWidget::setWindowOpacity ( qreal level );

bunjee
6th August 2009, 12:04
Hi,

I need that behavior on a classic QWidget not a window.

yogeshgokul
6th August 2009, 12:06
I need that behavior on a classic QWidget not a window.
Yes, that was for QWidget only.

bunjee
6th August 2009, 13:26
Masked widgets receive mouse events only on their visible portions.

The setWindowOpacity is not a suitable solution because I need that behavior.

Thanks anyway.

yogeshgokul
6th August 2009, 13:30
The setWindowOpacity is not a suitable solution because I need that behavior.
Then go ahead with setMask. :)