Answer the question
In order to leave comments, you need to log in
QML: Selecting an item in a ListView on mouse click. Maybe?
Good day. I can't figure out how to select the element under the cursor in the ListView by clicking it. How to do it?
And I would also like to scroll through the elements with the mouse roller.
Answer the question
In order to leave comments, you need to log in
I found a solution on the Internet, maybe it will help someone:
you need to define the MouseArea object in the delegate item and handle the LMB click in it:
Component
{
id: delegate
Item
{
MouseArea
{
anchors.fill: parent
onClicked:
{
myList.currentIndex = index
}
}
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question