mirelon
3rd February 2010, 21:20
I have a game with many animations. They are QPropertyAnimation applied to graphics items. I made a connect between signal finished() and my custom slot animationFinished(). At some point I want to cancel all animations and clean all graphics. I use this code to clean all:
foreach(QGraphicsItem* git,graphicsView->scene()->items()){
graphicsView->scene()->removeItem(git);
}
The graphics view is clear after executing this code. But after some time (maybe when some animation finishes), the animationFinished() is executed. I assume my code removes the graphics items, but the property animations are still there. How can I remove them?
foreach(QGraphicsItem* git,graphicsView->scene()->items()){
graphicsView->scene()->removeItem(git);
}
The graphics view is clear after executing this code. But after some time (maybe when some animation finishes), the animationFinished() is executed. I assume my code removes the graphics items, but the property animations are still there. How can I remove them?