Is it possible to set the opacity of qt widgets?

Exa picture Exa · Dec 21, 2010 · Viewed 27.7k times · Source

I know that there is a function QWidget::setWindowOpacity(qreal level) but as written in the documentation this does only work for windows.

Is there a way to make widgets that are lying inside layouts opaque too?

What I'm trying to do is an animation where widgets are fading in. I once did that with a preferences-dialog and there it worked.

So do you think there is a way or a work-around to achieve opacity for widgets inside layouts? How would you do that?

Thanks in advance!

Answer

Miguel Fuentes picture Miguel Fuentes · Jan 12, 2011

Just use QGraphicsOpacityEffect in order to achieve this effect.