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. Using QML TreeView in Qt5.5 alpha, how to create my own treemodel class?

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

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 1.2k 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.
  • C Offline
    C Offline
    CAlgary
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • TobyYiT Offline
      TobyYiT Offline
      TobyYi
      wrote on last edited by
      #2
      • I think you can do what you do in C++ for QTreeView

      将QtCoding进行到底,做Qt的宠儿
      关注移动互联网,关注手机助手
      开发即时通讯,服务于金融行业
      My github :https://github.com/toby20130333

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pheelbert
        wrote on last edited by Pheelbert
        #3

        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"
                     }
                 ]
            }
         }
        
        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