Selecting items by mouse click.

This commit is contained in:
2026-03-05 12:43:51 +01:00
parent b2e3b49814
commit ca59fc2b20
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import QtQuick
Item { Item {
id: myItem id: myItem
required property int index
required property string name required property string name
required property string info required property string info
property int fontSize: 16 property int fontSize: 16
@ -16,4 +17,8 @@ Item {
text: '<b>Info:</b> ' + myItem.info text: '<b>Info:</b> ' + myItem.info
} }
} }
MouseArea {
anchors.fill: parent
onClicked: parent.ListView.view.currentIndex = parent.index
}
} }

View File

@ -6,6 +6,7 @@ Page {
id: page id: page
ListView { ListView {
id: listView
anchors.fill: parent anchors.fill: parent
focus: true focus: true
clip: true clip: true