I need to use nested ListView in QML. In each item of the outer ListView, named by A, it will contain another ListView B.
I can easily expose the DataModel for A from C++, but how can I expose the list of DataModel for each B? I have a C++ class derived from QAbstractListModel, and expose an instance mySuperListModelA to QML for the ListView A by setContextProperty. In the instance of this class, I have a list of another QAbstractListModel subclass instance, but how can I expose them to QML for use by B? I used an INVOKABLE method in class A which will return a QAbstractListModel, and use it as the model of the inner ListView, but it doesn't work. Thanks James import Qt 4.7 Item { id: container Rectangle { id: menu width: 400 height: 600 color: "black" opacity: 0.75 radius: 0 clip: true Component { id: outerDelegate Column{ Text { text: "Site Title : " + title } Component { id: innerDelegate Column { Text { text: " Tab Title: " + tabtitle } } } Repeater { model: mySuperListModelA.subListModelAt(index) // return sub QAbstractListModel via INVOKABLE method of mySuperListModelA delegate: innerDelegate } } // Column } // Component ListView { id: outerlistview anchors.fill: parent delegate: outerDelegate model: mySuperListModelA opacity: 1 } // ListView } // Rectangle }
_______________________________________________ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml