1、界面中添加一个label,label中显示图片。
ui
->setupUi(this);
QMovie
*movie
=new QMovie(
"D:/Files/QT/aototest/3/aototest/2.png");
ui
->label
->setMovie(movie);
movie
->start();
2、添加资源文件,显示其中的文件
QPixmap pixmap;
//
if(pixmap.load(
"D:/Files/QT/aototest/3/aototest/2.png")) //绝对路径图片
if(pixmap.load(
":/images/test"))添加的资源文件
qDebug()<<
"successed\n";
else
qDebug()<<
"failed\n";
ui->label->setPixmap(pixmap);
ui->label->show();
转载请注明原文地址: https://ju.6miu.com/read-600342.html