QHeaderView - minor fix to createSectionSpan
authorThorbjørn Lund Martsum <tmartsum@gmail.com>
Thu, 15 Mar 2012 15:38:59 +0000 (16:38 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 20 Mar 2012 10:44:09 +0000 (11:44 +0100)
I am unsure if this is only theoretic - but if/when we have added
sections here - we must ensure that we recalculate startpositions.

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

index 425eb4c..4975e72 100644 (file)
@@ -3172,8 +3172,10 @@ void QHeaderViewPrivate::resizeSections(QHeaderView::ResizeMode globalMode, bool
 void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeaderView::ResizeMode mode)
 {
     int sizePerSection = size / (end - start + 1);
-    if (end >= sectionSpans.count())
+    if (end >= sectionSpans.count()) {
         sectionSpans.resize(end + 1);
+        sectionStartposRecalc = true;
+    }
     SectionSpan *sectiondata = sectionSpans.data();
     for (int i = start; i <= end; ++i) {
         length += (sizePerSection - sectiondata[i].size);