tags:

views:

36

answers:

0

I would like to display two related but separate lists in a single QTreeView widget, like so:

+----------------+
| item 1         |
| item 2         |
| item 3         |
| (separator)    |
| other item 1   |
| other item 2   |
| other item 3   |
+----------------+

When sorted, I would like to have each the items of each sub-list be sorted but only within their sub-list, for example, a descending sort would yield :

+----------------+
| item 3         |
| item 2         |
| item 1         |
| (separator)    |
| other item 3   |
| other item 2   |
| other item 1   |
+----------------+

I tried giving each sub-list a parent item, and then sort the children only, and it works fine. However, it adds an extra line for the parent, which I would like to get rid of :

+------------------+
| parent item 1    |  <-- I need to get rid of this line
|   item 3         |
|   item 2         |
|   item 1         |
| parent item 2    |  <-- I can live with this one, its label will act as a separator
|   other item 3   |
|   other item 2   |
|   other item 1   |
+------------------+

When I call QTreeView::setRowHidden() on the parent item's row, it hides the parent as well as its children. Is there a way to hide the line of a parent while still displaying all its children? If not, what would you recommend?

Thanks