《Qt5实战》之界面启动全屏加载背景图片
作者:互联网
void MainWidget::showEvent(QShowEvent *event)
{
//全屏
showFullScreen();
//动态加载背景图片
QPixmap pixmap("../images/bg.png");
QPixmap bgpixmap = pixmap.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); // 饱满填充
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(bgpixmap));
setPalette(palette);
}
标签:pixmap,palette,Qt5,Qt,bgpixmap,全屏,QPalette,背景图片 来源: https://blog.csdn.net/w1820020635/article/details/98615294