Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
Index for QTreeview from Root
padLing last edited by
I am using a Qtreeview and I need to obtain the index based on the root node and not based on the parent
--- 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)
Bihlerben last edited by
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.