I'm trying to implement a callback function on my QML ListModel to do some operations when the data inside the ListModel changes. Apparently, it's impossible to create on...Changed handlers for individual user-defined properties in a ListModel. So, I'm trying to use the onDataChanged handler available to ListModel.
ListModel {
id: model
onDataChanged: {
console.warn("onDataChanged: "+get(topLeft).val + " vs. " + get(bottomRight).val)
}
}
However, onDataChanged only ever seems to reference the very first element in the ListModel. That is to say, topLeft and bottomRight always point to the first element, even when I manipulate an element down the list.
What I need here is a reliable handler that accurately reflects the correct row in the ListModel when it fires off.