Take the 2-minute tour ×

I'm implementing an algorithm that calculates a path for disk robots in the plane and want to visualize the movement of the robots along this path.

A path is a vector of subpaths, where each subpath is a list of pair<QPointF,QPointF> elements. The first QPointF represents the current position of A, and the second of B. The two robots move simultaneously from one pair to the other.

I was able to successfully visualize the movement of the robots within the subpath using QPropertyAnimation for each robot and QtParallelAnimationGroup for the two QPropertyAnimation objects.

The problem is that for every subpath I have to display a certain graph (a set of lines/edges and points) on the screen that stays static throughout the animation of the subpath and changes only when the robots move to the next subpath.

I tried to add the graph to the display every time the QPropertyAnimation finishes the current animation of the subpath but it seems that the animation runs on the same thread as the code so I can't use while (propAnim->state() != QAbstractAnimation::Stopped){}.

Does anyone has suggestions how to overcome this problem?

share|improve this question

1 Answer 1

OK, I figured how to solve it.

For every QtParallelAnimationGroup, responsible for the animation of the subpath, I connected its finish() signal to a method that displays the next graph on the screen.

share|improve this answer

Your Answer


