@fcarney said in accessing elements of a ListModel:
onBottleListChanged: updateListModel()
Oh, OK...I see my problem now. I was trying to use this line of code from within the repeater. I see now that it should go in the containing Rectangle.
You call the function that rebuilds your ListModel. Don't you want that to update when it changes? Also, you said you had two lists of data. Does it have a signal too?
I have two sources of data: one in C++ and one in a QML ListModel. I actually have 2 QML ListModels, but only use one (which one to use is determined at runtime by an environment variable). The only signal is emitted by the C++ update function; nothing in the ListModels.
As it turns out, I've been able to eliminate the use of the QML update function entirely (though I still need the getColor routine() above, so I won't need to use this feature here, but this has been very educational. Thank you for all the help.