add and remove animations of ListView aren't always played
Unsolved
QML and Qt Quick
-
I use the following code to add an animation to items that are being added to a listview:
ListView { ... width: 600 spacing: 6 height: contentHeight model: ListModel {} delegate: MAlertBox { onDestroyAlert: index => alertList.model.remove(index) } add: Transition { NumberAnimation { property: "opacity" from: 0 to: 1.0 duration: 400 } NumberAnimation { property: "scale" from: 0 to: 1.0 duration: 400 } } remove: Transition { ParallelAnimation { NumberAnimation { property: "opacity" to: 0 duration: 250 } NumberAnimation { properties: "y" to: -40 duration: 250 } NumberAnimation { properties: "scale" to: 0.2 duration: 250 } } } }
But for some reason the remove animation is only played for the last element of the listview that is being removed and the add animation is played for every addition except the first one as you can see here: https://streamable.com/nj6vw2
Does someone have an idea why the animations don't always show up?