summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-05-31 08:11:36 +0200
committerLiang Qi <liang.qi@qt.io>2017-05-31 08:11:37 +0200
commit7ee80242de2744790e5c35662c14594981f8586d (patch)
tree69eaa80e6f7ecb5906f2ce125beeecec3965886b /src/widgets/itemviews
parentfa3940cc4b5580070f465d1f64a23a69bc925367 (diff)
parentf6b36eaafec24b4c67efff621d380a4ca4257d0b (diff)
Merge remote-tracking branch 'origin/5.9.0' into 5.9
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index e0e993ce77..76f80c680e 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3876,9 +3876,11 @@ bool QHeaderViewPrivate::read(QDataStream &in)
const int currentCount = (orient == Qt::Horizontal ? model->columnCount(root) : model->rowCount(root));
if (newSectionItems.count() < currentCount) {
// we have sections not in the saved state, give them default settings
- for (int i = newSectionItems.count(); i < currentCount; ++i) {
- visualIndicesIn.append(i);
- logicalIndicesIn.append(i);
+ if (!visualIndicesIn.isEmpty() && !logicalIndicesIn.isEmpty()) {
+ for (int i = newSectionItems.count(); i < currentCount; ++i) {
+ visualIndicesIn.append(i);
+ logicalIndicesIn.append(i);
+ }
}
const int insertCount = currentCount - newSectionItems.count();
const int insertLength = defaultSectionSizeIn * insertCount;