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

冷暖自知 提交于 2020-01-04 14:24:57

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/5769766/qt-how-to-show-gifanimated-image-in-qgraphicspixmapitem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!