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

Using QML TreeView in Qt5.5 alpha, how to create my own treemodel class?



  • I found an treeview QML example, it use qfilesystemmodel, but it is very complicated for me to learn

    I understand treeview in QML only support model class derived from QAbstractItemModel
    so parent, index, data should be derived

    my question is how to do that?

    Thanks



    • I think you can do what you do in C++ for QTreeView


  • Same question, that I have.

    In QML, how do you create a model with children?

    ex of what i'd want (that doesn't work):

    model: ListModel {
        ListElement {
            name: "Parent"
            children: [
                 ListElement {
                     name: "Child0"
                 },
                 ListElement {
                     name: "Child1"
                 }
             ]
        }
     }

Log in to reply