How to get ListModel elements in C++



  • @ListModel{
    objectName: "list"
    ListElement{
    name: "first"
    }
    ListElement{
    name: "second"
    }
    }
    @

    How can i get it's elements in c++?
    I tried to get model by it's name
    @ QObject list = object->findChild<QObject>("list"); @
    But i do not know what to do next.



  • you can access to all its children : list->children()


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.