How do you iterate through all elements of a QML ListModel?

3.6k Views Asked by At

How can you iterate through all the individual ListElement(s) of a ListModel in QML?

1

There are 1 best solutions below

0
DaveK On BEST ANSWER

I was surprised how hard it was to find an answer to this question myself. Since I could not find a related question already on SO, I'm answering it myself here.

for( var i = 0; i < listModelID.rowCount(); i++ ) {
    console.log( listModelID.get(i).<yourPropertyName> );
}