Skip to content

Commit

Permalink
fix: GridViewContainer itemAt() needs coordinate mapping
Browse files Browse the repository at this point in the history
修复 itemAt 与 indexAt 缺少座标系映射导致返回结果错位的问题

Log:
  • Loading branch information
BLumia committed Oct 18, 2023
1 parent 91707f1 commit c31e9cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions qml/GridViewContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ FocusScope {
property alias cellSize: item.cellSize

function itemAt(x, y) {
return gridView.itemAt(x, y)
let point = mapToItem(gridView, x, y)
return gridView.itemAt(point.x, point.y)
}

function indexAt(x, y) {
return gridView.indexAt(x, y)
let point = mapToItem(gridView, x, y)
return gridView.indexAt(point.x, point.y)
}

Item {
Expand Down

0 comments on commit c31e9cd

Please sign in to comment.