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. Index for QTreeview from Root

Index for QTreeview from Root

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.4k 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.
  • P Offline
    P Offline
    padLing
    wrote on last edited by
    #1

    Hi All,

    I am using a Qtreeview and I need to obtain the index based on the root node and not based on the parent

    Ex:
    RN
    --- Node 1
    --- Node 2
    --- Node 3
    --- --- Node 31
    --- --- Node 32
    --- Node 4
    --- Node 5
    --- --- Node 51
    --- --- Node 52

    Now when I click Node 31 or Node 32, I am getting it as 0/1 respectively. Instead can i get it as 3 & 4 when counted fromthe top Node (zero based index)

    Thanks,
    Pad

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bihlerben
      wrote on last edited by
      #2

      I have also thought about things like that, because I am also working with QTreeView's.

      But wouldn't your proposal lead to very strange behaviour? If a new item "Node 33" would be added as child of "Node 3", then all the indices of later nodes would be shifted - although they have nothing to do with the new node (just because they come later).

      Therefore I guess it is a good behaviour to use indices with respect to the parent items.

      Benjamin

      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