[SOLVED]How to play gif animation in QGraphicsView widget



  • The following code only shows a frame:
    @ scene.addPixmap(QPixmap::fromImage(image)); // image is a QImage object@



  • I guess you could add a QGraphicsProxyWidget to your scene

    set a QLabel to the ProxyWidget and then set the label to use your gif as a QMovie

    @
    QGraphicsScene scene;
    QLabel *gif_anim = new QLabel();
    QMovie *movie = new QMovie(image);
    gif_anim->setMovie(movie);
    movie->start();
    QGraphicsProxyWidget *proxy = scene.addWidget(gif_anim);
    @



  • Thanks worked like a charm!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.