.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include
#include
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QMovie *ptr_movie = new QMovie(":/abcd.gif");
ui->label->setMovie(ptr_movie);
ptr_movie->start();
QObject::connect(ptr_movie,&QMovie::frameChanged,[=](int frameNumber)
{
if (frameNumber == ptr_movie->frameCount()-1)
{
ptr_movie->stop();
}
});
}
MainWindow::~MainWindow()
{
delete ui;
}