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. TreeView Tree Model
Forum Updated to NodeBB v4.3 + New Features

TreeView Tree Model

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 550 Views 1 Watching
  • 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.
  • NevezN Offline
    NevezN Offline
    Nevez
    wrote on last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • NevezN Offline
      NevezN Offline
      Nevez
      wrote on last edited by
      #2

      the slightest help would be appreciated.

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        im not sure what effect you are after.
        So you want them to open on same level as parent so its more like a table than a tree ?

        Parent1 (click)
        Parent1 -> Child1
        and the other parents have nothing in col 2 unless expanded ?

        1 Reply Last reply
        0
        • NevezN Offline
          NevezN Offline
          Nevez
          wrote on last edited by
          #4

          yess.
          as you said, like this:
          parent1 -> child1 -> child2 -> child3 ...
          parent2 -> child1->child2-> child3 ...
          // that is, all children of the parent will be on the same row.

          need any help for this, thanks.

          JonBJ 1 Reply Last reply
          0
          • NevezN Nevez

            yess.
            as you said, like this:
            parent1 -> child1 -> child2 -> child3 ...
            parent2 -> child1->child2-> child3 ...
            // that is, all children of the parent will be on the same row.

            need any help for this, thanks.

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

            @Nevez
            My thought would be: it does sound like the structure you want to present for QTreeView to show is rather different from the structure native in your model, correct? In that case I would look at interposing a QAbstractProxyModel between your model and your view, to map what you want out of the model to what you want to see.

            NevezN 1 Reply Last reply
            2
            • JonBJ JonB

              @Nevez
              My thought would be: it does sound like the structure you want to present for QTreeView to show is rather different from the structure native in your model, correct? In that case I would look at interposing a QAbstractProxyModel between your model and your view, to map what you want out of the model to what you want to see.

              NevezN Offline
              NevezN Offline
              Nevez
              wrote on last edited by
              #6

              @JonB said in TreeView Tree Model:

              My thought would be: it does sound like the structure you want to present for QTreeView to show is rather different from the structure native in your model, correct? In that case I would look at interposing a QAbstractProxyModel between your model and your view, to map what you want out of the model to what you want to see.

              I saw what you said. I need some fresh examples or tips as I have never used a proxy before. If you have a source can you send it?

              1 Reply Last reply
              0
              • NevezN Offline
                NevezN Offline
                Nevez
                wrote on last edited by Nevez
                #7
                
                   -"id" -"name" "-surname"
                   - 1           -"John" "-salt"
                   - 2           -"Peter""-jenns"
                   -...
                

                QSortProxyModel to create this structure? or QIdentyProxyModel ? Would it be better if I use it? And I have no idea how to implement fromMapSource and mapToSource in particular. Can anyone explain with examples please?

                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