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?.
Asked
Active
Viewed 8,181 times
3
-
possible duplicate of [GIF animation in Qt](http://stackoverflow.com/questions/3248243/gif-animation-in-qt) – Mat Apr 24 '11 at 09:41
-
@Mat Thank you for your suggestion. But that answer can't serve my purpose. Because there is no way to add QMovie to QGraphicsPixMapItem. – prabhakaran Apr 24 '11 at 09:53
-
1Indeed, but you can make a QGraphicsProxyWidget from a QLabel and put that in your scene instead of the QGraphicsPixmapItem. This is also listed in the answers to the question linked above. – Mat Apr 24 '11 at 09:57
-
@Mat thank you. That worked very well except the background is not transparent. – prabhakaran Apr 24 '11 at 10:19
1 Answers
5
Check this answer from Nosf on this thread:
I guess you could add a
QGraphicsProxyWidget
to your sceneset a
QLabel
to theProxyWidget
and then set the label to use your gif as aQMovie
.
QGraphicsScene scene;
QLabel *gif_anim = new QLabel();
QMovie *movie = new QMovie(image);
gif_anim->setMovie(movie);
movie->start();
QGraphicsProxyWidget *proxy = scene.addWidget(gif_anim);

Abderrahmene Rayene Mihoub
- 1,875
- 3
- 6
- 19

Shajeen Ahamed
- 51
- 1
- 2