QHeaderView: Reset lastSectionLogicalIdx on clear()
Otherwise we can fail to stretch the last section when adding new sections. Task-number: QTBUG-52446 Change-Id: I7eb5267ac500bf4246e57c3e3a43268bb65ef1f7 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
This commit is contained in:
parent
a8390bb197
commit
fa95eb0554
@ -3465,6 +3465,7 @@ void QHeaderViewPrivate::clear()
|
||||
sectionSelected.clear();
|
||||
hiddenSectionSize.clear();
|
||||
sectionItems.clear();
|
||||
lastSectionLogicalIdx = -1;
|
||||
invalidateCachedSizeHint();
|
||||
}
|
||||
}
|
||||
|
@ -3014,6 +3014,11 @@ void tst_QHeaderView::stretchAndRestoreLastSection()
|
||||
header.swapSections(1, 11);
|
||||
QCOMPARE(header.sectionSize(1), someOtherSectionSize);
|
||||
|
||||
// Clear and re-add. This triggers a different code path than seColumnCount(0)
|
||||
m.clear();
|
||||
m.setColumnCount(3);
|
||||
QVERIFY(header.sectionSize(2) >= biggerSizeThanAnySection);
|
||||
|
||||
// Test import/export of the original (not stretched) sectionSize.
|
||||
m.setColumnCount(0);
|
||||
m.setColumnCount(10);
|
||||
|
Loading…
Reference in New Issue
Block a user