diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-03 14:40:32 (GMT) |
---|---|---|
committer | Pierre Rossi <pierre.rossi@nokia.com> | 2009-10-07 14:01:18 (GMT) |
commit | aa863c61ec5e68ff73c02e25a2954cdba9c2ef15 (patch) | |
tree | 29d05c319cf1c489fec3e7f2fadb20ae4e424943 /src | |
parent | cc95666378ee0aef1cc6b02b544fdf52645f6d9b (diff) | |
download | Qt-aa863c61ec5e68ff73c02e25a2954cdba9c2ef15.zip Qt-aa863c61ec5e68ff73c02e25a2954cdba9c2ef15.tar.gz Qt-aa863c61ec5e68ff73c02e25a2954cdba9c2ef15.tar.bz2 |
QHeaderView: fixed the sizeHint with hidden sections
We used to check the 100 first sections and 100 last sections
Now we make sure we check 100 visible sections
Task-number: 255574
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/itemviews/qheaderview.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index c5e6fed..b1306cc 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -526,20 +526,24 @@ QSize QHeaderView::sizeHint() const return d->cachedSizeHint; int width = 0; int height = 0; + d->executePostedLayout(); + // get size hint for the first n sections - int c = qMin(count(), 100); - for (int i = 0; i < c; ++i) { + int i = 0; + for (int checked = 0; checked < 100 && i < d->sectionCount; ++i) { if (isSectionHidden(i)) continue; + checked++; QSize hint = sectionSizeFromContents(i); width = qMax(hint.width(), width); height = qMax(hint.height(), height); } // get size hint for the last n sections - c = qMax(count() - 100, c); - for (int j = count() - 1; j >= c; --j) { + i = qMax(i, d->sectionCount - 100 ); + for (int j = d->sectionCount - 1, checked = 0; j > i && checked < 100; --j) { if (isSectionHidden(j)) continue; + checked++; QSize hint = sectionSizeFromContents(j); width = qMax(hint.width(), width); height = qMax(hint.height(), height); |