Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Is it possible to set QLabel background color and add transparent image to it?
qwe3 last edited by qwe3
I would like to set QLabel's baground to red. Next I have transparent png image ( circle ). I would like to set this image to label and get red background and a circle on it:
When I write "transparent png image circle" I think about this:
One way that comes to mind is to overwrite the paintEvent. In it fill the widget with red and then draw the image on top.
AlexMaly last edited by AlexMaly
I am not sure I understand the problem:
- You can always set pixmap which may have transparent color (created from the image). In this case all you need to change background of the QLabel (for example using stylesheet)
- Above way is good in most cases, but if your pixmap size is very different from label size, and you really want perfect look and scalability of the button you follow SGaist's suggestion and draw ellipse in the paint event instead using pixmap.