Semi-Transparent Background on Widget?
I'm using my own style, subclassing QWindowsStyle, and I'd like to make the background of a QWidget semi-transparent.
I've been re-drawing my own scrollbars and other widgets, so I'm somewhat familiar with QPainter and its setOpacity() method, but I can't seem to find the correct flag to override the QWidget's background.
What I'd basically like to do is have the main window's background semi-transparent and all the other widgets inside it opaque.
Can someone point me in the right direction?
Re: Semi-Transparent Background on Widget?
Do you mean a top level window, or a widget with a parent?
You might find this thread of interest.
Re: Semi-Transparent Background on Widget?
I am not sure how to make background transparent while all other widgets opaque.
But if you want to change background color, you can use QWidget::setPalette( const QPalette &) . If you want to change opacity of the whole widget then QWidget::setWindowOpacity( qreal level )
Hope this helps
Re: Semi-Transparent Background on Widget?
Don't forget setAutoFillBackground(true) if you change the background color in palette. Without that property, your widget will not draw its background.