QWidget 设置图片背景色

QPalette palette = this->palette();
palette.setBrush(QPalette::Window, QBrush(QPixmap(":/bak/gc.jpg").scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));// 使用平滑的缩放方式
this->setPalette(palette);

posted @ 2021-02-10 20:15  tonny1000  阅读(122)  评论(0)    收藏  举报