Here
you are using DataObject as a value type, meaning you are working with copies when adding to or reading from the vector.Qt Code:
std::vector<DataObject> mydata;To copy to clipboard, switch view to plain text mode
But DataObject is a QObject dervied class, instances of QObject cannot be copied.
You don't need the model's data clas to be derived from QObject, it is never directly exposed to QML.
Aside from that:
- you need a list model not a table model, as QtQuick only works on list models
- you need to overwrite the model's rolesNames() method to provide a mapping from QML role names to your role enum values.
- your MyXML method will want to work on the model that you expose to QML, not on newly created instances that get deleted at the end of the method
Cheers,
_





Reply With Quote
Bookmarks