Is it possible to set the opacity of qt widgets?
SetWindowOpacity
works for me in Linux. I used code like this to change window opacity, (value is from 0 to 100):
setWindowOpacity(qreal(value)/100);
Just use QGraphicsOpacityEffect in order to achieve this effect.
- Qt4: http://doc.qt.io/qt-4.8/qgraphicsopacityeffect.html
- Qt5: http://doc.qt.io/qt-5/qgraphicsopacityeffect.html
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 with setAutoFillBackground(True)
a small example: write inside the widget which is called inside the mainwindow
op=QGraphicsOpacityEffect(self)
op.setOpacity(1.00) #0 to 1 will cause the fade effect to kick in
self.setGraphicsEffect(op)
self.setAutoFillBackground(True)