Detecting onComplete of Repeater
-
Hello,
I use a repeater to display Items in a column.
And i need to detect the moment the repeater has finished the
instantiation of its items.Currently i use the onItemAdded and emit a signal when the last item was added.
But this doesn't work because after gettin the signal the properties of the repeaters
items may still change.What can i do to call a function after the repeater has build all its items. And the items
are done processing their properties ?Thanks for any help
-
I've never had exactly your problem, but in other case I got a similar problem.
So, when the onComplete it's not enough, I use an intermediate Loader.
But, I've never tried this approach on Repeater, so give a try and let me know.The idea is to wrapped the Repeated into a Loader item in this way:
@Loader {
id: repeaterWrapper
// this synchronize the loading of wrapped items
asynchronous: false
// this will hide everything during the creation of the Repeater
visible: false
sourceComponent: Repeater {
... your stuff ...
}
onStatusChanged: {
if ( status == Loader.Ready ) {
// do what you need to do after completation
visible = true
}
}
@ -
seems like a good approach. Didn't know that this is possible.
I may give it a try.
Thanks
-
Loader is one of my favorite item ... it's incredibile how you can exploit it do to a lot of stuff :-)
-
Nope this approach doesn't solved the problem.
Same behavior as before.The onStatusChanged signal emits another signal which is used
to process the repeaters items. But the log shows that the Items
in the Repeater still chance after the loader is finished.