[SOLVED] Is it possible to define an action for the removal of an item in a ListView?
-
So I have a ListView with a few dynamically created items. Some of the items have started a timer. At some point, the list gets refreshed and all references to the timers are gone.
Conclusion: Stop the timers before the item is removed from the list (with ListModel.clear()). Is it somehow possible to do this? I look for something like onVisibleChanged {do some fancy stuff when the visible property changed }. Or do you know any others solutions?Thanks in advance :-)
-
how about catching onRemove signal ? This will help you.
-
Yap, that is something I was thinking about, but there is no onRemove for Component or Item (The types my delegate for the list consists of and where the reference to the timer is held).
Where can I catch onRemove?
edit:
Ok, figured it out. Had to use
@ ListView.onRemove: {
console.log("Remove")
}@
On the first Item in the delegate (not one of the children) and it worked. Still strange that the QtCreator code completion doesnt "know" about the onRemove signal from ListView.