I'm trying to make program which uses Qt Kinetic Declarative UI: http://labs.trolltech.com/blogs/2009...eclarative-ui/
I've been trying to add items to ListView from C++ but it doesn't work. Static QML ListModel works just fine. I can't find the API online but it says you can pass C++ data models to QML.
- QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method.
- QStringList provides the contents of the list via the modelData role.
- QList<QObject*> provides the properties of the objects in the list as roles.
For example how do I make this model in C++ so I can add new elements in C++?
Qt Code:
ListModel { id: ContactModel ListElement { name: "Bill Smith" number: "555 3264" } ListElement { name: "John Brown" number: "555 8426" } ListElement { name: "Sam Wise" number: "555 0473" } }To copy to clipboard, switch view to plain text mode
Bookmarks