summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qheaderview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/itemviews/qheaderview.cpp')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 9a8206de45..70f8b28299 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1853,11 +1853,13 @@ bool QHeaderView::restoreState(const QByteArray &state)
*/
void QHeaderView::reset()
{
+ Q_D(QHeaderView);
QAbstractItemView::reset();
// it would be correct to call clear, but some apps rely
// on the header keeping the sections, even after calling reset
//d->clear();
initializeSections();
+ d->invalidateCachedSizeHint();
}
/*!
@@ -2871,6 +2873,7 @@ bool QHeaderView::viewportEvent(QEvent *e)
}
return true; }
#endif // QT_CONFIG(statustip)
+ case QEvent::Resize:
case QEvent::FontChange:
case QEvent::StyleChange:
d->invalidateCachedSizeHint();
@@ -3831,6 +3834,7 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
void QHeaderViewPrivate::setDefaultSectionSize(int size)
{
Q_Q(QHeaderView);
+ size = qBound(q->minimumSectionSize(), size, q->maximumSectionSize());
executePostedLayout();
invalidateCachedSizeHint();
defaultSectionSize = size;
@@ -4086,7 +4090,7 @@ bool QHeaderViewPrivate::read(QDataStream &in)
}
int sectionItemsLengthTotal = 0;
- foreach (const SectionItem &section, newSectionItems)
+ for (const SectionItem &section : qAsConst(newSectionItems))
sectionItemsLengthTotal += section.size;
if (sectionItemsLengthTotal != lengthIn)
return false;