Search code examples
c++qtopacityqwidget

Is it possible to set the opacity of qt widgets?


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!


Solution

  • Just use QGraphicsOpacityEffect in order to achieve this effect.