[Interest] Quick2 ListView - set current index to a new item when added
Preet
prismatic.project at gmail.com
Wed Dec 11 19:38:27 CET 2013
> I was a bit confused about that one, it has to be done like this, right?
> It's an attached signal handler, so...
>
> Component {
> id: myDelegate
> Item {
>
> ListView.onAdd: {
> // here it is, but what is the index?
> }
> }
> }
>
> If i use that, what's the index to use in positionViewAtIndex?
The index is exposed just as 'index' in the delegate itself.
> What's the difference between that one and Component.onCompleted?
I think Component.onCompleted is run any time something creates the
component, which might not be what you want if you're using the same
delegate for multiple views. The exact point at which ListView.onAdd
is called might also vary and that might be important if you're using
transition animations when modifying the ListView elements.
There are some other ways you can do it too -- using the
'onCountChanged' handler in the ListView, etc.
Preet
More information about the Interest
mailing list