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加上背景图

 

posted @ 2018-08-13 09:24  朱小勇  阅读(6438)  评论(0编辑  收藏  举报