c++ - Is there any possibility to reach the index of an outer QML Repeater from the inner one (they are nested)? -
i trying dynamically build matrix of same type of items in qml application , keep dynamic, can change number of rows , columns in c++ file anytime. has been working well, now, access them individually, want give them dynamic names. therefore nested 2 repeaters , tried set objectname in following:
repeater{ id: rows model: matrix1.row //number of rows in matrix1-object repeater{ id: columns model: matrix1.column //number of columns in matrix1-object repeateditem{ objectname: (index) +"."+ (rows.index) //matrix elements supposed numbered x.y because of nested repeaters, e.g. 0.0 first element } } }
unfortunately seem have no access outer index. first value shown, second value represented string undefined in textarea of gui. in case add new property outer repeater , set same value index, set once , keep first value (0) each repeated row.
is impossible dynamically reach outer index value somehow? or know better way dynamically create two-dimensional arrays of items in qml individually accessable?
the index
property context property. can store ordinary property, can access context:
repeater { id: rows // ... repeater { id: columns property int outerindex: index // ... text { text: index + "." + columns.outerindex } } }
Comments
Post a Comment