I am developing a custom plugin in Qt and there is this situation where I have to build a widget which has some an Image on it. So I am using QLabel as base class for my custom widget. Here's the code for paint event
QPixmap pic("/general/source/pic.png");
setAutoFillBackground(true);
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(pic));
this->setPalette(palette);
Now the image is rendered on the QLabel, but this is not what I desired.
- I want the image to scale to the size of the QLabel.
- I do not want the image repeating it self when the size of the QLabel goes beyond the size the image.
Please help.