DaveK
DaveK

Reputation: 715

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

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

Upvotes: 0

Views: 5038

Answers (1)

DaveK
DaveK

Reputation: 715

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> );
}

Upvotes: 5

Related Questions