Dialog::Dialog(QWidget *parent) :QDialog(parent),ui(new Ui::Dialog)
{
ui->setupUi(this);
ui->label->setScaledContents(true);
gif = new QMovie(":/resource/a.gif");
ui->label->setMovie(gif);
gif->start();
}
一定要将QLabel的setScaledContents属性设置true,否则GIF不会动