Hierarchical Header View
-
I need to display hierarchical headers in a table.
I found HierarchicalHeaderView from qt-apps.org, which works, to a degree.
The problem I'm having is that
QHeaderView::saveState()
andQHeaderView::restoreState(const QByteArray&)
don't work, and as such, my users can't save their column widths for subsequent runs of the program.- Is there a better hierarchical header view / table view available?
- Is there a way to easily implement hierarchical headers in a
QTableView
such that I can leverage the existingsaveState
/restoreState
? - How would I go about implementing
saveState
/restoreState
inHierarchicalHeaderView
?
For the qt-apps.org version of HierarchicalHeaderView, the source code, updated for Qt 5, can be downloaded from here
-
Further investigation into the issue has revealed that
HiearchicalHeaderView
re-implements the header views sections, and there is no relationship between theQHeaderView
notion of sections, and theHiearchicalHeaderView
notion of sections.As a result, the following calls are available, but return incorrect data.
QHeaderView::count()
returns 0
QHeaderView::sectionSize(int)
returns 0
QHeaderView::logicalIndex(int)
returns -1
etc...The upshot of this is that there is a significant amount of work required in
HierarchicalHeaderView
in order to make in feature complete, and that the way it is currently implemented is not symbiotic withQHeaderView
That essentially leaves 2 questions.
- Does an open source feature-complete hierarchical header view exist?
- Is there a way to easily implement hierarchical headers in a
QHeaderView
?