Discussion:
QHeaderView equivalent of QTableView::setSpan?
(too old to reply)
Murphy, Sean
2018-03-13 02:38:26 UTC
Permalink
Raw Message
I'm trying to figure out how to have a horizontal QHeaderView's sections span multiple columns. I know that within the table itself, table cells can be merged via QTableView::setSpan(int row, int column, int rowSpanCount, int columnSpanCount), but as far as I can tell, that functionality doesn't seem to exist in the header? A quick Google points me to this https://stackoverflow.com/questions/22755171/spanning-horizontal-header-in-qt that shows an example subclassing QHeaderView - is that the only way this is possible?



If it matters, I don't really particularly care if I use QTableWidget or a QTableView. I can play with the subclassing approach if necessary, I just wanted to make sure I wasn't missing something obvious. It seems like this should be built-in, it can't be that uncommon, can it?



Other possibly relevant specifications: the table will be read only, and the header would have header section 0 spanning just the first column, but then after that each header section would span 3 table columns, i.e.



| header 0 | header 1 | header 2 | ...

| table 0 | table 1 | table 2 | table 3| table 4 | table 5 | table 6 | ...



Sean






This message has been scanned for malware by Forcepoint. www.forcepoint.com
Loading...