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. QListView with animated icons
Qt 6.11 is out! See what's new in the release blog

QListView with animated icons

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.6k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Is there a good way to include animations within an itemview? I've got a QListView with items that have several icons, and some of the icons are animated. Is there a way to update the icon animation without redrawing the whole list? Can I do something clever like grab the draw rectangle in a custom delegate and then give it to an animated widget that redraws itself? Is there a standard way to do this?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      Hi,
      For the animated icon you can look into "QMovie":http://qt-project.org/doc/qt-4.8/qmovie.html#details, One approach can be to create your custom delegate to show a QLabel and listItems (text) for a single row and then create a QMovie from the animated icon(.gif) , then set the QMovie to QLabel. Eg

      @QMovie *movie = new QMovie(":Animations/icons/yourAnimatedIcon.gif");
      QLabel *yourLabel = new QLabel(this);
      yourLabel->setMovie(movie);
      movie->start();@

      Check if this works :)

      Note: Instead of using delegates you can easily use setItemWidget() for item widgets or setIndexWidget() for item views respectively for adding a lable to you item widget/view.

      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