QHeaderView - Do not try to remove non-existing section
authorThorbjørn Lund Martsum <tmartsum@gmail.com>
Thu, 15 Dec 2011 07:11:16 +0000 (08:11 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 1 Feb 2012 15:25:37 +0000 (16:25 +0100)
The end parameter passed to removeSectionsFromSpans is off by one.
removeSectionsFromSpans can currently handle/ignore it, but it is
still wrong.

Change-Id: I9148bd106504a37a5c8fd72928ab84c669eebcdb
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/widgets/itemviews/qheaderview.cpp

index 83c4fd0..33c8da4 100644 (file)
@@ -1940,7 +1940,7 @@ void QHeaderView::initializeSections(int start, int end)
 
     if (end + 1 < d->sectionCount) {
         int newCount = end + 1;
-        d->removeSectionsFromSpans(newCount, d->sectionCount);
+        d->removeSectionsFromSpans(newCount, d->sectionCount - 1);
         if (!d->hiddenSectionSize.isEmpty()) {
             if (d->sectionCount - newCount > d->hiddenSectionSize.count()) {
                 for (int i = end + 1; i < d->sectionCount; ++i)