You have to remember the delegate is a component so you don't have one delegate per view but rather one delegate per visible item. To access an item from a view you have ListView.currentItem, ListView.highlightItem or ListView.itemAt.
So for example to know whether the current item is checked, you'd do:
property bool indeeee: currentItem.check
property bool indeeee: currentItem.check
To copy to clipboard, switch view to plain text mode
However often you want to provide a relation in the other direction:
ListView {
property int checkedIndex: -1
delegate: MouseArea {
// ...
onClicked: ListView.view.checkedIndex = index // upon clicking I become the checked index in the view
}
}
ListView {
property int checkedIndex: -1
delegate: MouseArea {
// ...
onClicked: ListView.view.checkedIndex = index // upon clicking I become the checked index in the view
}
}
To copy to clipboard, switch view to plain text mode
Just remember that only the delegate root (and not its children) has the "ListView" attached property and the "index" property available.
Bookmarks