From ca59fc2b205376f81d65fe09e2d25c3dc6541af7 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Thu, 5 Mar 2026 12:43:51 +0100 Subject: [PATCH] Selecting items by mouse click. --- ListItemDelegate.qml | 5 +++++ ListPage.qml | 1 + 2 files changed, 6 insertions(+) diff --git a/ListItemDelegate.qml b/ListItemDelegate.qml index eee6822..19b481c 100644 --- a/ListItemDelegate.qml +++ b/ListItemDelegate.qml @@ -2,6 +2,7 @@ import QtQuick Item { id: myItem + required property int index required property string name required property string info property int fontSize: 16 @@ -16,4 +17,8 @@ Item { text: 'Info: ' + myItem.info } } + MouseArea { + anchors.fill: parent + onClicked: parent.ListView.view.currentIndex = parent.index + } } diff --git a/ListPage.qml b/ListPage.qml index 3402adb..0871b2d 100644 --- a/ListPage.qml +++ b/ListPage.qml @@ -6,6 +6,7 @@ Page { id: page ListView { + id: listView anchors.fill: parent focus: true clip: true