QPropertyAnimation vs animated svg item

  • Hi all,

    I have an idea and would like to know if it is good or bad, or maybe this should be done differently.

    I have an application that displays quite a lot jpg/png items on QGraphicsView. Items are arranged one on another, at specific coordinates and they are animated with QPropertyAnimation, or if necessary pixmaps are changed to simulate different item state (eg. on/off, disabled/enabled).

    I could make the same effects if I switch to svg files and manipulate their xml content. Eg. some elements are disabled/enabled, color is changed, position of some elementId is changed. What I want to achieve is to change apperance of my QGraphicsItem not by changing pixmap but by manipulating their xml code. For instance if I want some elementId to move periodically (lets say its a watch and I want to move hand) I need QTimer inside my item (derived from QGraphicsSvgItem) to call some slot periodially and reload renderer with new xml content.

    The question is:
    Is this the right method?
    Will this be fast enough? I was testing QGraphicsSvgItem's a while ago (Qt 4.8) and on the telephone (Nokia N8) it was working slowly. When I was moving background image (with a few QGraphicsSvgItems on it) outside and inside of QGraphicsView the movement wasn't smooth, as if the CPU had a lot more to do with SVG items than with png/jpg, the view was cutting - I hope You know what I mean.

    So should it work better now with Qt 5.5 ?
    Some optimalization hints, other ideas ?

    Best Regards

  • Lifetime Qt Champion


    The N8 and the current phone can't really compete hardware wise. However back to software, the current trend for highly animated application is to use QtQuick 2.

Log in to reply