PDA

View Full Version : Merge columns in QTreeView



Ginsengelf
3rd September 2014, 08:17
Hi, I have a QTreeView with a QStandardItemModel. Since the entries in the top level items can be a little long (and all columns except the first one are empty) I would like them to use the space of the other columns as well instead of just the first column:
This is what I've got:


Col1 | Col2 | Col3
>Top_Le... |
>0 | 1 | 2
>3 | 4 | 5
>6 | 7 | 8

This is what I want:


Col1 | Col2 | Col3
>Top_Level_With long_Text
>0 | 1 | 2
>3 | 4 | 5
>6 | 7 | 8
>2nd_Top_Level_With long_Text
>0 | 1 | 2
>3 | 4 | 5
>6 | 7 | 8

In QTableView there is a method to set span on the cells, but I haven't found anything similar in QTreeView. I could use QTableView, but I like the expanding/collapsing feature of the tree.

Ginsengelf

wysota
3rd September 2014, 08:21
QTreeView::setFirstColumnSpanned()

Ginsengelf
3rd September 2014, 08:43
Thanks, in german I would say "Tomaten auf den Augen".

Ginsengelf