Search code examples
c++qtmodel-view-controllerqtreeview

QTreeView merge some cells


I have a custom QAbstractItemModel and custom tree view.
Is it possible to merge some cells in QTreeView?

It shold looks like this:

Num | Name      | Qty | .... |
----|-----------|-----|------|
1   | Unit one  |  5  | .... |
1.1 | Sub unit1 |  3  | .... |
1.2 | Very very big string   |
1.3 | Sub unit2 |  2  | .... |

Also, QTreeWidget::setFirstColumnSpanned() do not that is necessary.


Solution

  • I would go with a custom Delegate here. Either for the whole row, or just column.