I have a ListModel:
ListModel {
ListElement {
property: "value"
}
ListElement {
property: "value2"
}
}
which I am trying to access from a c++ Qt class.
I've managed to get a reference to the listmodel:
QQmlEngine engine;
QQmlComponent component(&engine,
QUrl("qrc:///path.qml"));
QObject *object = component.create();
Debbuging the object gives me a QQmlListModel(adress).
object -> chlidren() gives me nothing, object -> children().count() shows 0.
I tried making a QList or QTableView from the object, but with no luck.
How can I get the values of the ListElements ?
ListModelis private and should not be used. Using custom QAbstractItemModel implementation could solve the problem.class Q_QML_PRIVATE_EXPORT QQmlListModel : public QAbstractListModel=> This means you can use theQAbstractListModel-API to read out everything you need. Also to alter the content.