Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QGraphicsItem::advance(int phase) how do they work
houmingc last edited by
I looked at the "colliding mouse example":http://doc.qt.nokia.com/4.7-snapshot/graphicsview-collidingmice.html that ships with Qt. And QGraphicsItem Class Reference http://doc.qt.digia.com/4.6/qgraphicsitem.html#advance. Don't exactly understand the parameter int phase.
alex_malyu last edited by
This function is called twice.
int parameter indicates phase.
If it 0 - it is called BEFORE any changes occur.
So you can prepare to change if you need.
If it is 1 - function is called after the change occurred.
houmingc last edited by houmingc
I understand advance work like a animation function, where each call simulate into a movement.
Help me to interpret below function.
1> how does this statement move the item at speed 5 ?? setPos(mapToParent(-(speed),0));
2> why need mapToParent ?
void BoxAnimation::advance(int phase)
QPointF location = this->pos();
speed =5; //5 pixel per sec set in constructor.