QML ListView Acess To an Item of the delegate

this is my code :

main.qml

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Scroll")

Button {
    id:btn
    x : 100
    y : 100
    text: "Click Her to check one of the checkbox! "
}
ScrollView {
    width: 40
    height: parent.height
    ListView {
        id : view
        width: parent.width
        leftMargin: 5
        model: 20
        delegate:
            MyCheckBox {
        }
      }
   }
}

MyCheckBox.qml

CheckBox {
    id : chk
    width: 25
    height: 25
}

i wanna check on of the Checkbox with the Button OnClicked ( for example when i click, i Check the ItemAtIndex 2) , to do this i need to access to the Object of my listview, there is a function available since QT 5.13 Item itemAtIndex(int index) but i’m using QT 5.12, is there another way to do it ? Thanks for your help

80 thoughts on “QML ListView Acess To an Item of the delegate”