diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-06 09:04:27 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-06 12:18:17 (GMT) |
commit | 039c800f728054a56ae1584d269ee1ddadd1312f (patch) | |
tree | 0827a13a26f9c9c813b0eb2fe9ea996874c3871a /src/gui/itemviews | |
parent | 33604fb02fa463f36fa78e515bb42a34a746f0f2 (diff) | |
download | Qt-039c800f728054a56ae1584d269ee1ddadd1312f.zip Qt-039c800f728054a56ae1584d269ee1ddadd1312f.tar.gz Qt-039c800f728054a56ae1584d269ee1ddadd1312f.tar.bz2 |
QHeaderView::sizeHint: small bug fix and refactor
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qheaderview.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 57e44c7..2419c18 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -524,12 +524,12 @@ QSize QHeaderView::sizeHint() const Q_D(const QHeaderView); if (d->cachedSizeHint.isValid()) return d->cachedSizeHint; - d->cachedSizeHint = QSize(0, 0); - d->executePostedLayout(); + d->cachedSizeHint = QSize(0, 0); //reinitialize the cached size hint + const int sectionCount = count(); // get size hint for the first n sections int i = 0; - for (int checked = 0; checked < 100 && i < d->sectionCount; ++i) { + for (int checked = 0; checked < 100 && i < sectionCount; ++i) { if (isSectionHidden(i)) continue; checked++; @@ -537,8 +537,8 @@ QSize QHeaderView::sizeHint() const d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); } // get size hint for the last n sections - i = qMax(i, d->sectionCount - 100 ); - for (int j = d->sectionCount - 1, checked = 0; j > i && checked < 100; --j) { + i = qMax(i, sectionCount - 100 ); + for (int j = sectionCount - 1, checked = 0; j >= i && checked < 100; --j) { if (isSectionHidden(j)) continue; checked++; |