@mzimmers correct,
you can give your QML ListView literally anything as a model :D if it is an actuall Qt based ItemModel of some kind, you can access data via the roles of the model:
ListView {
model: myModel
delegate: Item {
Text {
text: model.someCustomRole // Access data via custom role
}
}
}
for all other cases it is via modelData
ListView {
model: ["a", "b", "c"]
delegate: Item {
Text {
text: modelData // Access data for this specific index
}
}
}
or manual index lookup
property var myModel: ["a", "b", "c"]
ListView {
model: myModel
delegate: Item {
Text {
text: myModel[index]
}
}
}
So, I think the answer is is that I don't necessarily need a proper model for access to the struct, as long as I've created Q_PROPERTY to its elements?
yes, it doesn't have to be a full blown QObject base class either, Q_GADET is enough, prevents you from using signals though.