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. ItemView (QTreeView and QTableView)
Qt 6.11 is out! See what's new in the release blog

ItemView (QTreeView and QTableView)

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.3k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi there I have one Model having lot of data, I want to show this model in TreeView, model has Ten Node and four child node for each Ten node, I can show this in my treeview but now I want to show all child node in QtableView I dont know how to do it, I see pple suggest using proxy but can there be any other way without using proxymodel?
    I just want to show a subset of the model in my tableview please help

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      If you only want to show the children of a particular node of the tree then setting the tree model on the QTableView and setting QTableView::setRootIndex() to the index of the parent node should do it.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        it works partially, I want to show all the child of the node in column but is showing all the child as Row
        like i RootNode A having 4 child my table after setting rootIndex as rootNode is showing all four child as 4 rows of one column, how can I show that as one row of 4 column?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          You will need a proxy model to transpose rows for columns. Here's an example for a strictly tabular model that you may be able to use as a starting point:
          http://www.qtcentre.org/wiki/index.php?title=Transpose_proxy_model

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            ChrisW: Thanx for this link I will try this

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              Note that it won't work out of the box, as the model you're trying to transpose is (part of a) tree, not a table. So, you'll need to adapt the proxy to basically also get a setRootIndex, and only transpose anything under that index.

              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