Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
-
Windows 10
Description
To reproduce:
- Enable the vertical header in QTableView
- Add several rows into the model
- Save header's state
- Create a new QTableView with an enabled vertical header, but without any data
- Restore the saved header state
Actual result: header generates empty rows, though the model doesn't contain them.
E.g.
QTableView::reset doesn't help.
Most probably the issue is in here
void QHeaderView::initializeSections(int start, int end) { Q_D(QHeaderView); Q_ASSERT(start >= 0); Q_ASSERT(end >= 0); d->invalidateCachedSizeHint(); int oldCount = d->sectionCount(); if (end + 1 < d->sectionCount()) { // <=== int newCount = end + 1; d->removeSectionsFromSectionItems(newCount, d->sectionCount() - 1); if (!d->hiddenSectionSize.isEmpty()) { ...