You have MouseArea in your list of vertical lists that steals all events into your horizontal ListView. The best practice in QML is to include all MouseArea components inside the delegate.
In addition, instead of using the indexAt(mouseX,mouseY) method indexAt(mouseX,mouseY) use the index property, which is available to all delegates.
To propagate the mouse event from the delegate of the MouseArea list to list2 delegate MouseArea , use mouse.accepted = false
Item { id:main width: 360 height: 640 Component{ id:myDelegate ListView{ id:list2 spacing: 5 width:list.width height:list.height/3 interactive: true orientation: ListView.Horizontal model: ListModel { ListElement { name: "Bill Smith" number: "555 3264" } ListElement { name: "John Brown" number: "555 8426" } ListElement { name: "Sam Wise" number: "555 0473" } ListElement { name: "Sam Wise" number: "555 0473" } ListElement { name: "Sam Wise" number: "555 0473" } } delegate: Text { text:name width: main.width/3} focus: true MouseArea { anchors.fill: parent onClicked: { list2.currentIndex = index; } } } MouseArea { anchors.fill: parent onClicked: { list2.ListView.view.currentIndex = index; mouse.accepted = false; } } } ListView { id: list clip: true spacing: 5 anchors.fill: parent orientation: ListView.Vertical model: Model{} delegate:myDelegate focus: true } }
Niraj d
source share