On Tue, 11 May 2010 03:48:20 am ext Stephen Kelly wrote:
> Martin Jones wrote:
> >> * Can't access the data of the current item in the view from outside the
> >> delegate. Inside the implementation of a delegate, it is possible to use
> >> model.customDataRole inside the implementation of a delegate, but if in
> >> another element you want to get particular data for "the current item
> >> selected in that view", it doesn't seem possible in QML.
> >
> > The current item is available via ListView::currentItem.
>
> The challenge is to access the custom data from a C++ model through its
> data() method of the "current" item. Possibly putting the text of the
> current item somewhere else in the ui etc. As an example, try to access the
> display role of the current item in this QML model:
The reason is that those are context properties internal to the delegate. If
you want to expose some of the delegate's data you could bind them to a
property:
Component
{
id :myDelegate
Row {
property variant display : model.display
Text { height : 20; text : "Something" }
Text { height : 20; text : model.display }
}
}
--
Martin
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml