QWidget设置背景图

1、使用QSS出现很多问题

2、方法

this->setAutoFillBackground(true);
QPalette palette = this->palette();
palette.setBrush(QPalette::Window,QBrush(QPixmap(":/LHTFDES/Resources/set.jpg").scaled(this->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));// 使用平滑的缩放方式
this->setPalette(palette);// 给widget加上背景图
原文地址:https://www.cnblogs.com/judes/p/9466275.html