QPropertyAnimation on QGraphicsItem freezes app
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.
int Count =0;
AnimatedGraphicsItem *aPStatus = new AnimatedGraphicsItem();
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);
I found some posts which descriped the same problem but none with a solution.
Thanks and regards
I'm not sure but try setting "setCacheMode":http://qt-project.org/doc/qt-5/qgraphicsitem.html#setCacheMode to DeviceCoordinateCache.
thanks for your reply. I already set the CacheMode to DeviceCoordinateCache without success. Any further ideas?