Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Nested ListView setting / accessing properties
Forum Updated to NodeBB v4.3 + New Features

Nested ListView setting / accessing properties

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 436 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Etienne123
    wrote on last edited by A Former User
    #1

    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
    
    ListView{
        model : model1
        delegate : listDelegate
    }
    
    Component{
        id : listDelegate
        MyDelegate{
                console.log(name)       
            property list<Item> componentList:[
               MyDelegate{
                   console.log(textTest)
               }
            ]
        }
    }
    

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved