Qt的 - 如何显示QGraphicsPixmapItem GIF(动画)图片 [英] Qt - How to show gif(animated) image in QGraphicsPixmapItem

查看:4342
本文介绍了Qt的 - 如何显示QGraphicsPixmapItem GIF(动画)图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在QGraphicsPixmapItem使用一个闪烁的图像。图像显示没有动画效果。以下是原始图像,下面是这QGraphicsPixmapItem使用这个形象QGraphicsScene。任何人都可以说,如何实现这一目标?

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?.

推荐答案

使用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);

这篇关于Qt的 - 如何显示QGraphicsPixmapItem GIF(动画)图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆