Reputation:
I'm trying to move a sprite in a QGraphicsView. I use :
connect(timer, SIGNAL(timeout()), scene, SLOT(advance()));
timer->start(1000/33);
But my sprite is not repainted. I've to do alt-tab to update the view.
Upvotes: 1
Views: 1776
Reputation: 4626
Similar to this (QGraphicsScene is missing a particular item update), you simply invalidate the are of your object in the scene and let the scene take care of updating.
Upvotes: 1
Reputation: 22366
in the first phase, all items are notified that the scene is about to change, and in the second phase all items are notified that they can move.
The docs imply that this is an animation notification tool for scene items, it says nothing about actually updating the view. You probably need to connect your QTimer::timeout()
signal to the QGraphicsScene::update()
slot.
Upvotes: 1