mirror of
https://github.com/tnodir/fort
synced 2024-11-15 10:15:07 +00:00
UI: ListView: Improve item selection by click.
This commit is contained in:
parent
9ba4a2cd22
commit
09125c1c6d
@ -32,8 +32,14 @@ ListView {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
const index = listView.indexAt(listView.contentX + mouse.x,
|
||||
listView.contentY + mouse.y);
|
||||
const mouseX = listView.contentX + mouse.x;
|
||||
const mouseY = listView.contentY + mouse.y;
|
||||
|
||||
var index = listView.indexAt(mouseX, mouseY);
|
||||
if (index < 0) {
|
||||
index = listView.indexAt(mouseX, mouseY - listView.spacing);
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
listView.currentIndex = index;
|
||||
listView.clicked(index);
|
||||
|
Loading…
Reference in New Issue
Block a user