QListView with animated icons

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

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

    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.

Log in to reply

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