PDA

View Full Version : QTreeWidgetItem - Is it possible to use 2nd column as root?



Hookem
1st December 2008, 23:38
Hi,

Just getting to know Qt and doing it through PyQt. I'm set up through Eric4 and the latest version of PyQt4.

I'm wondering if it's possible to use the 2nd column in a tree widget as the root, meaning that column gets the parent/child treatment with the root decoration. Basically I want to use the first column as one which holds the numerical value of the tree level and doesn't need to be indented with each sub-level.Then the second column shows the level breakdown. Like this:

1 Parent
1.1 Child
1.2 Child

I tried using the numerical value in the 2nd column, but it doesn't look good. I'm not very familiar yet with all of the models, so I may be going about this the wrong way. However I can't quite get this to look right.

Thanks

wysota
2nd December 2008, 01:44
As far as I know the tree will always show the branches in the first column.

spirit
2nd December 2008, 05:37
I permofed root column in another column by subclassing QTreeView and swapping columns, but they looked ugly after that. :)