Important: Please read the Qt Code of Conduct -

Nested ListView setting / accessing properties

  • Hi!
    I'm trying to develop the following pattern in QML but without success. MyDelegate being a simple .qml file containing some rectangles and some text to display. The original goal was to display two nested lists : a vertical one containing the horizontal ones. Both of these lists have strings to display. I tried to make a very simple snippet of code of what i'm trying to achieve :

    property ListModel model1
        model : model1
        delegate : listDelegate
        id : listDelegate
            property list<Item> componentList:[

    I'm trying to fill this listView this way in another .qml file

    model1.append({ "name" : "itsName" ,
                          "componentList" :
                                { "testText" : "test1"} ,
                                { "testText" : "test2" }

    Thing is i can display "name" correctly, but i can"t acces testText in the second Delegate! Is there a way to achieve this ? What am I doing wrong ? I tried to use the get() and setProperty() functions of ListModel using two models instead of one, but didn't manage to do it aswell.. Any help would be greatly appreciated.

Log in to reply