Hi Bruce!
ListPage contains a property called model, which defines the data that should be shown. Each property in QML (the programming language) supports reacting to changes of properties via signals.
The corresponding signal for the model property would be onModelChanged, which is also available using autoCompletion. You can use it like this:
ListPage {
onModelChanged: {
// do something when the model changes!
}
}
The model is often described as an Array of objects. In contrast to simpler data types (like strings or integers), the modelChanged signal is not triggered automatically if some value within the array changes, as Qt does not detect all potentially little changes within a highly variable structure like an array:
ListPage {
id: page
function changeModel() {
// this will not trigger onModelChanged
page.model[0] = { text: "New Entry" }
// but this will trigger onModelChanged
page.model = []
}
}
By manually calling modelChanged(), we can trigger the onModelChanged() signal whenever we change some value within the model. Thus all signal handlers run the appropriate code and also the ListPage will update its view to display the newest model version. Otherwise changes won’t be visible or propagated as the signal is not triggered automatically.
So the reason why modelChanged is not in the API reference or auto-completion, is because it is not something added by Felgo, but just the way how Qt/QML allows to developers to manually trigger signals.
Hope this helps!
Cheers,
Günther