Hi,
I've been able to use QDeclarativeListProperty to expose a simple list to QML. For instance
Qt Code:
Q_PROPERTY(QDeclarativeListProperty<MyQObjectDerivedClass> myprop READ myprop NOTIFY mypropChanged)To copy to clipboard, switch view to plain text mode
However, it would be convenient to be able to expose a QMap<QString, MyQObjectDerivedClass*> model to QML instead so that in QML I can access the elements of the model by name (i.e., something like _mymap["Toyota"].year in QML).
How can I go about this? Do I have to derive a class from QAbstractItemModel to achieve this, or is there a simpler approach?
Thanks!
Bookmarks