Your QML is trying to access the "cars" property on the "peronsModel" object, not the "cars" role on any specific index.
For access to the "cars" role you would need a custom delegate, as it has access to the roles of its index through "model.rolename".
If your PersonsModel instance is only used for that specific combobox, then you could add the property your QML is currently trying to access and have it hold a CarsModel that gets changed whenever the combobox changes its current index.
Alternatively you could have a function that returns the CarsModel for a given index
Q_INVOKABLE CarsModel* carsForRow(int row);
Q_INVOKABLE CarsModel* carsForRow(int row);
To copy to clipboard, switch view to plain text mode
and call that from QML
ListView {
model: personsModel.carsForRow(combo.currentIndex)
}
ListView {
model: personsModel.carsForRow(combo.currentIndex)
}
To copy to clipboard, switch view to plain text mode
Cheers,
_
Bookmarks