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. Custom column order in tree view
QtWS25 Last Chance

Custom column order in tree view

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 327 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.
  • M Offline
    M Offline
    m3g1dd
    wrote on last edited by
    #1

    I want to achieve this tree view in QML:

    Screenshot

    The problem is:

    • How to have branch delegate (expand/collapse icon) as the last column
    • How to add a custom column before items, i.e. as the first column

    As far as I test, in QML TreeView:

    • Branch delegate is located as the first column, not the last one
    • Adding column to the end is straight forward, but how to add a custom column as first column?
    TreeView {
        model: cppScene.sceneModel
        // ...
        style: TreeViewStyle {
            branchDelegate: Item {
                // ...
                // ... The very first column contains branch delegate
            }
        }
        TableViewColumn {
            title: qsTr("Entities")
            role: "name"
            // ... adding column to the end is straight forward
        }
        TableViewColumn {
            // ...
            // ... adding column to the end is straight forward
        }
        TableViewColumn {
            // ...
            // ... adding column to the end is straight forward
        }
    }
    

    An example would be helpful.

    JonBJ 1 Reply Last reply
    0
    • M m3g1dd

      I want to achieve this tree view in QML:

      Screenshot

      The problem is:

      • How to have branch delegate (expand/collapse icon) as the last column
      • How to add a custom column before items, i.e. as the first column

      As far as I test, in QML TreeView:

      • Branch delegate is located as the first column, not the last one
      • Adding column to the end is straight forward, but how to add a custom column as first column?
      TreeView {
          model: cppScene.sceneModel
          // ...
          style: TreeViewStyle {
              branchDelegate: Item {
                  // ...
                  // ... The very first column contains branch delegate
              }
          }
          TableViewColumn {
              title: qsTr("Entities")
              role: "name"
              // ... adding column to the end is straight forward
          }
          TableViewColumn {
              // ...
              // ... adding column to the end is straight forward
          }
          TableViewColumn {
              // ...
              // ... adding column to the end is straight forward
          }
      }
      

      An example would be helpful.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @m3g1dd
      Isn't this question for the QML sub-forum? You are looking for a QML solution.

      M 1 Reply Last reply
      1
      • JonBJ JonB

        @m3g1dd
        Isn't this question for the QML sub-forum? You are looking for a QML solution.

        M Offline
        M Offline
        m3g1dd
        wrote on last edited by m3g1dd
        #3

        @JonB Right, the post is moved to QML and Qt Quick sub-forum =)

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved