summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-03-14 11:54:14 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-03-14 11:54:14 +0100
commit38b20a433d9a565b054930641368f8e4cd47ee29 (patch)
treeee70d571e1505291119e76c497fffc5adc89d206 /src/widgets
parent2b4078cbb0d6bde9a681d1b3120aa586ab6c162d (diff)
parent4c0a363a9a0b73c68fd252cba705396d4378b209 (diff)
Merge 5.9 into 5.9.5
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 91331b84be..d5ab9f3208 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2075,9 +2075,15 @@ void QHeaderViewPrivate::_q_layoutAboutToBeChanged()
layoutChangePersistentSections.clear();
layoutChangePersistentSections.reserve(std::min(10, sectionItems.count()));
// after layoutChanged another section can be last stretched section
- if (stretchLastSection) {
+ if (stretchLastSection && lastSectionLogicalIdx >= 0 && lastSectionLogicalIdx < sectionItems.count()) {
const int visual = visualIndex(lastSectionLogicalIdx);
- sectionItems[visual].size = lastSectionSize;
+ if (visual >= 0 && visual < sectionItems.size()) {
+ auto &itemRef = sectionItems[visual];
+ if (itemRef.size != lastSectionSize) {
+ length += lastSectionSize - itemRef.size;
+ itemRef.size = lastSectionSize;
+ }
+ }
}
for (int i = 0; i < sectionItems.size(); ++i) {
auto s = sectionItems.at(i);