QT窗口界面背景自定义

//自定义背景  
this->setAutoFillBackground(true);   
QPalette palette = this->palette();
//使用平滑的缩放方式 
palette.setBrush(QPalette::Window,QBrush(QPixmap("./1.jpg").scaled(this->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));   
//给窗口界面加上背景图
this->setPalette(palette);        

猜你喜欢

转载自blog.csdn.net/weixin_43793181/article/details/112002783