3
votes

I have defined a grid like below using repeater

Grid {
    id: grid
    x: 8;y:8
    clip: true
    smooth: false
    rows: 6; columns: 6; spacing: 3
    Repeater {
        id:table
        model:36
        Cell {     //an item created by me
            clip:true
            color:"blue"
              }
    }
}

I want to get position of any cell in the grid. For that, somewhere in QML file, I wrote x:table.itemAt(3).Center

But itemAt is not working. In fact, when I am writing table. the QT is not showing itemAt in the suggestion tooltip. What to do?

1
It is Qt, not QT which could mean QuickTime and that is definitely not what you want. And accept the answer given if it did solve your problem - Sнаđошƒаӽ

1 Answers

4
votes

QML Grid Element doesn't provide itemAt method. But, seems, here it is what you are looking for:

Item::childAt ( real x, real y )

Returns the visible child item at point (x, y), which is in this item's coordinate system, or null if there is no such item. Look here