Qml delegate index belongs to who?

606 Views Asked by At

I want to know to who the index role belongs to. ListModel, ListView or others? How to test it?

ListModel{ 
    id:testModel

    ListElement{ 
        //  ....
    }

    //  ....
}

ListView{

    model:testModel

    delegate: 
        Column {
        Label{
            text:index
        }
    }
}
1

There are 1 best solutions below

0
On

The index property is exposed to the delegate by means of the ListView. That property is an int, so it's probably passed by copy and you won't interfere with the attachee's logic by modifying it. For the delegate is a component handled by the ListView, you can safely suppose that the index property belongs to the latter and reflects a feature due to the provided model.

What does it mean "how to test it"?