P
P
Pavel2012-11-30 19:14:12
Android
Pavel, 2012-11-30 19:14:12

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

3 answer(s)
P
Pavel, 2012-11-30
@FluffyMan

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
                    }
                }
        ...
}

M
mhspace, 2012-12-03
@mhspace

I would recommend waiting for Qt5 with QtComponents.

T
Timofey, 2013-01-23
@mr_T

See the documentation for State, Transition and MouseArea.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question