QHeaderView::setDefaultSectionSize to handle auto size of sections.

setDefaultSectionSize should respect auto resized sections like
QHeaderView::resizeSection(). When setDefaultSectionSize is called
we should process a possible pending resize and afterwards we
should do a (delayed) resize of the sections (if we have autosized
sections)

Change-Id: Ie09e6f073c944b58693ffbbd1d1a8b60104c1a55
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Thorbjørn Lund Martsum 2012-11-12 13:37:04 +01:00 committed by The Qt Project
parent 045b151911
commit cf27bc6277

View File

@ -3370,6 +3370,7 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
void QHeaderViewPrivate::setDefaultSectionSize(int size)
{
Q_Q(QHeaderView);
executePostedLayout();
invalidateCachedSizeHint();
defaultSectionSize = size;
for (int i = 0; i < sectionItems.count(); ++i) {
@ -3385,6 +3386,8 @@ void QHeaderViewPrivate::setDefaultSectionSize(int size)
}
}
sectionStartposRecalc = true;
if (hasAutoResizeSections())
doDelayedResizeSections();
}
void QHeaderViewPrivate::recalcSectionStartPos() const // linear (but fast)