Is there any possibility to reach the index of an outer QML Repeater from the inner one (they are nested)?

给你一囗甜甜゛ 提交于 2019-12-05 15:29:05

The index property is a context property. You can store it to an ordinary property, so you can access it from another context:

Repeater {
    id: rows
    // ...
    Repeater {
        id: columns
        property int outerIndex: index
        // ...
        Text {
            text: index + "." + columns.outerIndex
        }
    }
}

Personally I have solved it using just one Repeater with the following model property: Matrix1.column * Matrix1.row. Furthermore I realized that for my purpose it is fine just calculating row and column of the clicked element with %- and /- operators, row number, column number and the recently accessed index.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!