PDA

View Full Version : Reset my QgraphisPixmapItem position



firebeard6666
23rd February 2014, 22:52
Hello there,

I m doing a frogger. I did create my "vehicule" item gave it a position, move it with QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance()));
however, how can I make it go back to his original position and and let it do his animation again. How can I detect the end how my scene should I use QRectF boundingRect() const;

Regards

anda_skoa
24th February 2014, 08:23
QGraphicsItem::setPos() allows you to set any position you want, so also to set the coordinates that coincide with "start position".

Cheers,
_

firebeard6666
24th February 2014, 16:21
Sure man for the setPos(). But how can I detect the end my scene?

Regards.

anda_skoa
24th February 2014, 19:01
I am afraid I don't understand.

Clearly you must have a specific situation that you consider to be the end, so check for that situation's values.

Cheers,
_