I have tries as per your suggestion.
QImage img
("/home/nirav/img.png");
frame.setGeometry(0,0,250,250);
frame.show();
label.setGeometry(0,0,200,200);
pixmap = pixmap.fromImage(img);
palette.
setBrush(label.
backgroundRole,
QBrush(pixmap
));
label.setPalette(palette);
label.show();
QImage img("/home/nirav/img.png");
QFrame frame;
frame.setGeometry(0,0,250,250);
frame.show();
QLabel label(&frame);
label.setGeometry(0,0,200,200);
QPixmap pixmap;
pixmap = pixmap.fromImage(img);
QPalette palette;
palette.setBrush(label.backgroundRole, QBrush(pixmap));
label.setPalette(palette);
label.show();
To copy to clipboard, switch view to plain text mode
but still I am getting some many no of images in label .
I thing this happens because when I create a object of QBrush by passing Pixmap as argument in constructor it takes Qt::TexturePattern. that's way I am getting no of image instead of single one.
This Qt:: TexturePattern is default for QBrush::QBrush(const QImage & img) & QBrush::QBrush(const QPixmap & pixmap)
Can anybody help me solve this problem & how to show a single image in background instead of so many images.
Suggestion would be appreciated.
Bookmarks