I'm using the graphics objects to display boxes with arrows between them. I want animation on those arrows/lines that starts at one end and goes to the other.

The animation works great when the start and end locations of the arrow don't change during QTimeLine execution, i.e. I leave the view static.
But since the user can drag the boxes around (and thus I redraw the arrows to follow) I need to reset the start and end position inside the QGraphicsItemAnimation so the animation matches the new arrow line.

I tried to update the start and end locations in the paint method of the Arrow object but that just makes the animation go crazy (it flips randomly all over the place). I assume it's because I changed the animation positions when the QTimeLine object was in the RUNNING state.

Qt Code:
  1. void Arrow::paint(QPainter *painter,
  2. {
  3. ...
  4. ///update the arrow to have a new source and destination, draw arrow, etc
  5. ...
  6.  
  7. if (mAnimate)
  8. {
  9. mAnimationObj->setPosAt(0, mSourcePoint);
  10. mAnimationObj->setPosAt(1, mDestPoint);
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 


How should I dynamically change the QGraphicsItemAnimation start and end positions (0 and 1)?

For the end product, I want the user to be able to drag the boxes around, have the arrows follow (which currently works) as well as have the animation continue along the new arrow route.

If that isn't possible, then I need to figure out some way to capture the dragging and stop the arrow animation until the user releases and then I guess reset it...?

Thanks