Add to a ListModel a ListElement from C++



  • How can I add to a ListModel, a ListElement from c++? may I use a c++ class that represents the equivalent qml object?
    thanks



  • You can't directly create a ListElement in C++ but what you can do is to create any model deriving from QAbstractItemModel, such as QStandardItemModel just like you would in a widget based application, expose that to qml and assign it to the model property of ListView.


Log in to reply
 

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