Qt - How to show gif(animated) image in QGraphicsP

2019-08-02 06:34发布

I am trying to use one blinking image in QGraphicsPixmapItem. The image has shown without the animation effect. The below is the original image, the following is the QGraphicsScene which uses this image in QGraphicsPixmapItem. Can anybody say how to achieve this?.

enter image description here

enter image description here

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-02 06:50

use this code

QGraphicsScene scene;
QLabel *gif_anim = new QLabel();
QMovie *movie = new QMovie(image);
gif_anim->setMovie(movie);
movie->start();
QGraphicsProxyWidget *proxy = scene.addWidget(gif_anim);
查看更多
登录 后发表回答