From 8713f22372b7aa63ecafbe87214b8994203fac5f Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 4 Nov 2018 18:43:00 +0100 Subject: QHeaderView: Fix updating hidden sections during initializeSections() QHeaderView::initializeSections() was calling updateHiddenSections() with wrong parameters which lead to an inconsistency in the hidden section handling. updateHiddenSections() needs the first and last index which got removed. Therefore we must pass the new section count for logicalFirst. Fixes: QTBUG-55461 Change-Id: Ica06125cf19bdd500f55fd9cd59ace1795f3703f Reviewed-by: David Faure --- src/widgets/itemviews/qheaderview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index b7de69d63a..e9091ca1a2 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2321,9 +2321,10 @@ void QHeaderView::initializeSections() if (stretchLastSection()) // we've already gotten the size hint d->maybeRestorePrevLastSectionAndStretchLast(); - //make sure we update the hidden sections + // make sure we update the hidden sections + // simulate remove from newCount to oldCount if (newCount < oldCount) - d->updateHiddenSections(0, newCount-1); + d->updateHiddenSections(newCount, oldCount); } } -- cgit v1.2.3