项目建立完成后:
右键点你的项目 “Add New”->"QT Resource file" 生成一个qrc文件
右击bejing.qrc,选择open in edit。 点“添加”去添加想要加入的背景图片. 在main.cpp代码中加入背景图片,代码如下 w.setAutoFillBackground(true);
QPalette palette;
QPixmap pixmap(":/bz.jpg");
palette.setBrush(QPalette::Window, QBrush(pixmap));
w.setPalette(palette);