On Thu, Mar 24, 2011 at 2:29 PM, Alexey Zaryanov <[email protected]> wrote:
> If i have C++ model where each item have another model inside. How can id
> implement this?
> For example:
> Listview{
> model: myCPPmodel
> .............
> ............
> delegate: Item{
> .............
> ListView{
> model: myModelFromCPPmodel
> ....
> {
>
> }
> }
>
> It is possible ?
Yes. I'm not sure if it can be done while using a QAbstractItemModel
as the root model because the returned values are QVariants (right?),
but for QList<QObject*> models it's possible to define a Q_PROPERTY of
type QList<QObject*> and then access that. So your inner list
definition would look something like:
ListView {
id: innerList
model: model.modelData.innerModel }
I'm not sure if the model part of model.modelData.innerModel resolves
to innerList's model property, but if it does then I guess you can
work around it with some proxy property with a different name.
Juha
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml