[Qt-qml] how to expose nested ListModel from C++ to QML?
bea.lam at nokia.com
bea.lam at nokia.com
Fri Dec 10 06:15:54 CET 2010
And ignore the duplicate 'outerDelegate' id below - that should only be in the Repeater, not the Component.
On 10/12/2010, at 3:09 PM, ext bea.lam at nokia.com wrote:
> Hi James,
>
> On 10/12/2010, at 2:20 PM, ext Wei, Xiaohai wrote:
>
>> Thanks.
>>
>> another question on nested listview.
>>
>> How can inner delegate get the index of current outer model index?
>>
>
> One way to do it is to add a property to each delegate of the outer view, which holds the 'index' value of that the delegate. The index can then be accessed by the inner view. E.g.
>
> Component {
> id: outerDelegate
>
> Repeater {
> id: outerDelegate
> property int outerIndex: index
>
> model: ...
> delegate: Text { text: outerDelegate.outerIndex }
>
> }
> }
>
> regards,
>
> Bea
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
--
Bea Lam
Software Engineer
Nokia, Qt Development Frameworks
More information about the Qt-qml
mailing list