How to change the opacity of the Qt MainWindow by some values?
My main window contains nothing but just somehow I need to change the opacity using keystrokes.
It looks like this now.
I tried to set using this->setWindowOpacity(0.5);
didn't get anything opacity effect.
The below works for me most of times (as long as we can run in stylesheet override problem with other ways). Consider change the last component of rgba to less than 255 for making it semi-transparent.
Mind that child widgets may inherit the transparent background of parent widget by default unless you specify "background-color: rgba(255, 255, 255, 0);" for them or limit the visibility of upper stylesheet somehow e.g. "QMainWindow(background-color: rgba(255, 255, 255, 255);}".