Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to access nested Repeater's item property



  • Column {
            Repeater {
                id: calloutColOuter
                model: 3
                delegate: Rectangle {
                    id: outerDel
                    width: 57 
                    height: 20
    
                    Column {
                        Repeater {
                            id: calloutColInner
                            model: 3
                            delegate: Text {
                                text: " "
                                color: "red"
                                width: 10
                                height: 10
                            }
                        }
                    }
                }
            }
        }
    

    So here, there are two nested repeater. I want to access inner repeater's item by index value. I tried accessing first item of inner repeater by giving this :- "calloutColOuter.itemAt(0).children[0].children[0].itemAt(0).text"
    But this is giving error.

    After that i tried giving this :- calloutColOuter.itemAt(0).children[0].children[0].text
    this is working good but this is printing first item's text, I want to access text of second and third item also.

    Any idea, how can i access Second and third item text also ?

    Thanks :)


  • Qt Champions 2017

    Give the id to each column item & try to access the children. It should work.


  • Qt Champions 2018

    @dheerendra said in How to access nested Repeater's item property:

    Give the id to each column item & try to access the children. It should work.

    No it won't. The inner Column is not in the same context.

    @Bhushan_Sure said in How to access nested Repeater's item property:

    Any idea, how can i access Second and third item text also ?

    What's your higher goal? What do you want to achieve? What you are trying to do raises some red flags.


Log in to reply