PDA

View Full Version : Fixed Column in QTreeview



ormonde
11th May 2008, 17:02
Hello,

I've created a Qtreeview with a large number of columns and I'd like the first one (which is a header for the rows) to be fixed when the user scrolls the treeview contents.

I was able to implement this feature by exchanging the first column with the first column in the viewport each time the scrollbar value changes, but it doesn't work very well.

Is there an easy way to keep the first column always in the first position, even when the contents are scrolled ?

Thanks in advance,

Rodrigo

jpn
11th May 2008, 19:26
People have usually done this by placing two separate views next to each other. Both views use the same model while duplicate columns being hidden.

ormonde
12th May 2008, 00:11
I thought about it. In fact I created a layout with 2 treeviews separated by a splitter. It works, but visually it's not the same thing as a single treeview.

wysota
12th May 2008, 07:49
Make sure you set the spacing between widgets of the layout to 0. It'll look a bit better then.