From bdcb3f9aab139e31849aec46088dce52ba7673eb Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Wed, 14 Jan 2015 22:19:47 +0100 Subject: QHeaderView: fix restoring Qt4 state. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When multiple sections were grouped together, sectionItem.size was the total size of grouped sections, not the size of one section. Task-number: QTBUG-40462 Change-Id: I401a1583dd30880ccf5b4c105a237d6563f212e8 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qheaderview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index aad382ed49..6e8def1407 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3727,12 +3727,14 @@ bool QHeaderViewPrivate::read(QDataStream &in) QVector newSectionItems; for (int u = 0; u < sectionItemsIn.count(); ++u) { int count = sectionItemsIn.at(u).tmpDataStreamSectionCount; + if (count > 0) + sectionItemsIn[u].size /= count; for (int n = 0; n < count; ++n) newSectionItems.append(sectionItemsIn[u]); } int sectionItemsLengthTotal = 0; - foreach (const SectionItem& section, sectionItemsIn) + foreach (const SectionItem §ion, newSectionItems) sectionItemsLengthTotal += section.size; if (sectionItemsLengthTotal != lengthIn) return false; -- cgit v1.2.3