1.在样式表里设置
background-image: url(".....");//图片地址
这种方式很方便快捷,只是如果我们游戏中需要切换不同的场景,那这种方法就不大适用了。
2.QPixmap绘制
QPainter p(this);
p.drawPixmap(0,0,this->width(),this->height(),QPixmap(":/res/PlayLevelSceneBg"));
通过设置图片的伸缩宽高可以实现图片适应窗口伸缩
1.在样式表里设置
background-image: url(".....");//图片地址
这种方式很方便快捷,只是如果我们游戏中需要切换不同的场景,那这种方法就不大适用了。
2.QPixmap绘制
QPainter p(this);
p.drawPixmap(0,0,this->width(),this->height(),QPixmap(":/res/PlayLevelSceneBg"));
通过设置图片的伸缩宽高可以实现图片适应窗口伸缩

被折叠的 条评论
为什么被折叠?