QPropertyAnimation on QGraphicsItem freezes app



  • Hi,

    I´m animating a QGraphicsItem with QPropertyAnimation. I´ve subclassed QGraphicsItem like it´s descriped in the docs (setting Q_PROPERTY etc.).

    If I put more than one of these animations into a QParallelAnimationGroup the CPU load is up to 25% and my whole application freezes for the time of the animation. If I replace the QGraphicsItem with a QPushbutton everything is fine.

    Code:
    @
    int Count =0;

    do
    {
    AnimatedGraphicsItem *aPStatus = new AnimatedGraphicsItem();
    m_scene->addItem(aPStatus);

    QPropertyAnimation *statusAni = new QPropertyAnimation(aPStatus,"pos");
    statusAni->setDuration(1600);
    statusAni->setStartValue(QPoint(0, 0));
    statusAni->setEndValue(QPoint(pB->pos().x() + 10, pB->pos().y() + 10));
    statusAni->setEasingCurve(QEasingCurve::InCurve);
    statusAni->setLoopCount(-1);
    m_GroupAnimStatus->addAnimation(statusAni);
    Count++;
    

    }while(Count < 3);

    m_GroupAnimStatus->start(QPropertyAnimation::DeleteWhenStopped);
    @

    I found some posts which descriped the same problem but none with a solution.

    Thanks and regards


  • Moderators

    Hi,

    I'm not sure but try setting "setCacheMode":http://qt-project.org/doc/qt-5/qgraphicsitem.html#setCacheMode to DeviceCoordinateCache.



  • Hi,

    thanks for your reply. I already set the CacheMode to DeviceCoordinateCache without success. Any further ideas?


Log in to reply
 

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