summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-03 16:40:32 +0200
committerPierre Rossi <pierre.rossi@nokia.com>2009-10-07 16:01:18 +0200
commitaa863c61ec5e68ff73c02e25a2954cdba9c2ef15 (patch)
tree29d05c319cf1c489fec3e7f2fadb20ae4e424943 /src/gui
parentcc95666378ee0aef1cc6b02b544fdf52645f6d9b (diff)
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')
-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 c5e6fed30f..b1306cc259 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);