Reputation: 60481
I have a QWidget that contains a QPixmap
and a QComboxBox
in its Layout. I would like to set the background of the widget transparent (but I want to show the QPixmap
and the QComboBox
normally). How do I do that?
Upvotes: 3
Views: 13590
Reputation: 158
You can use the attribute
widget->setAttribute(Qt::WA_NoSystemBackground);
Indicates that the widget has no background, i.e. when the widget receives paint events, the background is not automatically repainted. Note: Unlike WA_OpaquePaintEvent, newly exposed areas are never filled with the background (e.g., after showing a window for the first time the user can see "through" it until the application processes the paint events). This flag is set or cleared by the widget's author.
Upvotes: 4
Reputation: 52397
It is all well-explained in QWidget documentation: http://doc.qt.io/qt-5/qwidget.html#transparency-and-double-buffering
Upvotes: 1