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.
  • N Offline
    N Offline
    Nevez
    wrote on 25 Feb 2022, 11:16 last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nevez
      wrote on 26 Feb 2022, 04:59 last edited by
      #2

      the slightest help would be appreciated.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 26 Feb 2022, 09:20 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
        • N Offline
          N Offline
          Nevez
          wrote on 28 Feb 2022, 07:12 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.

          J 1 Reply Last reply 28 Feb 2022, 10:02
          0
          • N Nevez
            28 Feb 2022, 07:12

            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.

            J Offline
            J Offline
            JonB
            wrote on 28 Feb 2022, 10:02 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.

            N 1 Reply Last reply 2 Mar 2022, 12:29
            2
            • J JonB
              28 Feb 2022, 10:02

              @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.

              N Offline
              N Offline
              Nevez
              wrote on 2 Mar 2022, 12:29 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
              • N Offline
                N Offline
                Nevez
                wrote on 3 Mar 2022, 08:29 last edited by Nevez 3 Mar 2022, 08:30
                #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

                1/7

                25 Feb 2022, 11:16

                • Login

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