I am using a QStandardItemModel model with a tree data structure, meaning I have tables 1 level below the root level. I switch each (sub-level) table between a QTableView using QTableView::setRootIndex(). This works fine except that the number of vertical header items does not match the row count of the sub-level item, it continues to match the row count of the root item.

I do not want to set custom labels I just want the number of header items to match the number of rows. The user will be adding and deleting rows dynamically. Is there an easy way to override the default behavior? It seems like an oversight that setRootIndex() does not already take care of this, or am I missing something obvious?

QTableView::setHeaderRootIndex() would be nice.

cheers