Can QTreeView be used to show a tree upside-down, with children above their parents?



  • In our video application we want the child nodes of one of our trees to be displayed above their parent. This would cause the whole tree to be inverted. I've done a fair amount of searching but I haven't found any reference to this. I'm guessing it's possible with QTreeView but if anyone has any hints and/or example code they can share it would be appreciated.


  • Moderators

    Hi, welcome to devnet.

    It's not possible with tree view. You can only implement a model that would populate the tree, but the whole thing, layout, the little lines indicating parenthood etc. are rigged to look like a normal top-down tree.

    You'd have to implement that widget from scratch I'm afraid. I guess you could start from a QListView and implement the collapsing and visual aids.

    Btw. I don't think I have ever seen such a construct in any software. Are you sure this will be intuitive to the user? With lots of children you'd need to scroll down just to close a tree branch. That sounds uncomfortable to use.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.