tags:

views:

130

answers:

1

I'm using Qt4 and I have a QTableView which displays data using a custom model. I'd like to have two rows in the table header, ideally with some of the cells in the first row spanning multiple columns. Is this possible?

+2  A: 

You can make a custom header by making a QTableWidgetItem and then using the setHorizontalHeaderItem(). The method takes a column number, so I am not sure if that will allow for spanning multiple columns natively -- however, at the very least you could use the same QTableWidgetItem for several columns.

As far as using two rows in the header, I do not believe this is currently supported. However, you could probably add this functionality by rolling your own derived class of QTableWidget if you are ambitious.

swanson