I tried the following code but in vain.
setAutoFillBackground(true);
//QPalette palette = this->palette();
this->setPalette(palette);
setAutoFillBackground(true);
//QPalette palette = this->palette();
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(QPixmap(":/Resources/topGradient.png")));
this->setPalette(palette);
To copy to clipboard, switch view to plain text mode
I tried with stylesheet but doing so caused the child widgets (buttons, labels) inherit the background image. So it's not suitable for my need.
setStyleSheet("background-image: url(:/Resources/topGradient.png);");
setStyleSheet("background-image: url(:/Resources/topGradient.png);");
To copy to clipboard, switch view to plain text mode
Can you please tell me why the use of QPalette for setting background image did not work?
Thanks.
Bookmarks