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!
SetWindowOpacity
works for me in Linux. I used code like this to change window opacity, (value is from 0 to 100):In Qt5 you can use css to make widgets transparent
Well for widgets inside mainwidow appear to have
setAutoFillBackground(False)
by default.to make it fade in fadeout u need to to use
QGraphicsOpacityEffect
along withsetAutoFillBackground(True)
a small example: write inside the widget which is called inside the mainwindow
Just use QGraphicsOpacityEffect in order to achieve this effect.