Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QML Repeater itemAt not working

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?

like image 657
Harsh Choudhary Avatar asked Jan 20 '26 04:01

Harsh Choudhary


1 Answers

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

like image 69
Max Go Avatar answered Jan 23 '26 09:01

Max Go



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!