I try to set the background of a widget to an image as indicated in Assistant in the
Porting to QT4 of setPaletteBackgroundPixmap :
QPixmap pixmap
(":/images/bArchi.png");
palette.
setBrush(widget
->backgroundRole
(),
QBrush(pixmap
));
widget->setPalette(palette);
setCentralWidget(widget);
QWidget *widget = new QWidget;
QPixmap pixmap(":/images/bArchi.png");
QPalette palette;
palette.setBrush(widget->backgroundRole(), QBrush(pixmap));
widget->setPalette(palette);
setCentralWidget(widget);
To copy to clipboard, switch view to plain text mode
I played around with many combinations of the above code, but nothing will show my
image. The background remains unchanged...
Bookmarks