Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How I can create a interactive TreeView using QML?
QtWS25 Last Chance

How I can create a interactive TreeView using QML?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.0k 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.
  • mandruk1331M Offline
    mandruk1331M Offline
    mandruk1331
    wrote on last edited by
    #1

    I want to create an interactive TreeView using QML, a tree that will expand and vice-versa, can someone give a code snippet on how I can do that, or maybe a reference on where I can learn how I can do that? thank you

    Mandruk1331

    jsulmJ 1 Reply Last reply
    0
    • mandruk1331M mandruk1331

      I want to create an interactive TreeView using QML, a tree that will expand and vice-versa, can someone give a code snippet on how I can do that, or maybe a reference on where I can learn how I can do that? thank you

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @mandruk1331 If you search for "qml treeview" on Google you will find http://doc.qt.io/qt-5/qml-qtquick-controls-treeview.html
      Isn't that what you are looking for?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      mandruk1331M 1 Reply Last reply
      0
      • jsulmJ jsulm

        @mandruk1331 If you search for "qml treeview" on Google you will find http://doc.qt.io/qt-5/qml-qtquick-controls-treeview.html
        Isn't that what you are looking for?

        mandruk1331M Offline
        mandruk1331M Offline
        mandruk1331
        wrote on last edited by
        #3

        @jsulm yes. But the problem that I don't really get how to build a tree model, it has to be like an ordinary tree and then I have to pass the object of the completed tree to QML?

        Mandruk1331

        jsulmJ 1 Reply Last reply
        0
        • mandruk1331M mandruk1331

          @jsulm yes. But the problem that I don't really get how to build a tree model, it has to be like an ordinary tree and then I have to pass the object of the completed tree to QML?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mandruk1331 You need to provide a model like in the example:

          TreeView {
              TableViewColumn {
                  title: "Name"
                  role: "fileName"
                  width: 300
              }
              TableViewColumn {
                  title: "Permissions"
                  role: "filePermissions"
                  width: 100
              }
              model: fileSystemModel
          }
          

          If you need something special, then you will need to implement such a model by yourself.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          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