Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]How to play gif animation in QGraphicsView widget
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]How to play gif animation in QGraphicsView widget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 16.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nosf
      wrote on last edited by
      #2

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

      1 Reply Last reply
      1
      • A Offline
        A Offline
        adnan
        wrote on last edited by
        #3

        Thanks worked like a charm!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved