Hierarchical Header View



  • I need to display hierarchical headers in a table.

    I found HierarchicalHeaderView from qt-apps.org, which works, to a degree.

    table

    The problem I'm having is that QHeaderView::saveState() and QHeaderView::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 existing saveState / restoreState?
    • How would I go about implementing saveState / restoreState in HierarchicalHeaderView?

    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 the QHeaderView notion of sections, and the HiearchicalHeaderView 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 with QHeaderView

    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?

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.