Animating delegate Rectangle - need to stop animation - but need to reset state
-
I have a list view with an associated model, the delegate for this list view create a rectangle with a thick border.
When someone clicks on an item (instance of the delegate) I set a flag on the model element to indicate that it is 'selected.'
When the user clicks a different item or clicks the same item again, the selected item is unselected and the new item is flagged as selected.
It's easy to put an animation on the delegate rect that start running the animation like this
running: selected
That works great for starting and stopping the animation, but the problem is that when the animation stops I need to reset the associated property back to its original value.
The only way I've managed to think of doing that is trying to call ::complete() on the animation which is part of the instanced delegate. The problem with this is that from what I've been able to read this isn't possible as you can't reliably access delegate instances.
If there was some 'stopped' property on the animation where I could set the value I want whenever the animation isn't running, I'd be fine.
Suggestions?