summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qheaderview.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-03 14:40:32 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-03 14:45:14 (GMT)
commit208bba0abd8a417cf8fdfd61295682738df3bc67 (patch)
tree63ff1dd7feb1a6d5239dc4861aab3fa72c4f3fd0 /src/gui/itemviews/qheaderview.cpp
parent7bc98d7bd7aabc6086e5cd27a167769d7aa71d83 (diff)
downloadQt-208bba0abd8a417cf8fdfd61295682738df3bc67.zip
Qt-208bba0abd8a417cf8fdfd61295682738df3bc67.tar.gz
Qt-208bba0abd8a417cf8fdfd61295682738df3bc67.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/gui/itemviews/qheaderview.cpp')
-rw-r--r--src/gui/itemviews/qheaderview.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index aea288b..a73f85a 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -528,20 +528,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);