On Tue, Aug 31, 2010 at 12:42 AM, <[email protected]> wrote: > On 08/31/2010 03:44 AM, ext Alex wrote: > > Hi all, > > I am instantiating a bunch of components inside a Repeater, based on a > ListModel. In some cases, I need to act (e.g., invoke a javascript > function) directly on the delegate of a particular model element. Is > there a way to access the delegate instance which corresponds to a > particular model element? > > Cheers, > Alex > _______________________________________________ > Qt-qml mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-qml > > If you have something like: > Item { > id: item > Repeater { > model: myListModel > .... > } > } > > you should be able to do: > > item.children[index-to-the-delegate-you-want-to-access].property-you-want-to-access > > It seems that the one child created from the Repeater itself (containing > e.g. the 'count' property) is always the last child. Not sure, if this is an > 'API' that we can count on :) > > - Tapani >
Thanks, Tapani and Gregory. I was expecting to find these as children of the Repeater, but reparenting to the parent of the Repeater makes sense. Cheers, Alex _______________________________________________ Qt-qml mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-qml
