Details
-
Type:
Bug
-
Status: Reported
-
Priority:
P2: Important
-
Resolution: Unresolved
-
Affects Version/s: 5.15.2
-
Fix Version/s: None
-
Component/s: Widgets: Itemviews
-
Labels:None
-
Environment:Windows 10
-
Platform/s:
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()) { ...