path: root/src
diff options
authorThorbjørn Lund Martsum <>2011-12-11 20:28:01 +0100
committerQt by Nokia <>2011-12-14 18:18:59 +0100
commitf86007175d7d9d592e9cf6499704ad4f17944ce4 (patch)
tree92fac24f01451927e0fba163046319439321f723 /src
parenteeade8bf9ce89a05b459790406763f409f9449e6 (diff)
QHeaderView::ResizeToContents slow hide fix
I have been a bit confused about what QHeaderView::ResizeToContents does good. It only sizes depending of the visible part. However in hide it goes crazy and checks calculates size hints for every row. At first I considered to solve it in QTableView. It could be made to calculate the maximum height of the maximum screen - however I decided not to touch it since I was not certain that it wouldn't have any unexpected side effects. Therefore I instead made this patch which is more simple and seems to be safer. The logic is that when a QHeaderView is hidden we actually only want to recalculate sizes if the headerview has a visible parent. Task-number: QTBUG-14234 Change-Id: I186ab6afa95aed43022f2bb7c36e3fd008355d9b Reviewed-by: Stephen Kelly <>
Diffstat (limited to 'src')
1 files changed, 7 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 36784f6424..8ecbdeb8bd 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2405,7 +2405,13 @@ bool QHeaderView::viewportEvent(QEvent *e)
return true; }
- case QEvent::Hide:
+ case QEvent::Hide: {
+ d->invalidateCachedSizeHint();
+ QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget());
+ if (parent && parent->isVisible()) // Only resize if we have a visible parent
+ resizeSections();
+ emit geometriesChanged();
+ break;}
case QEvent::Show:
case QEvent::FontChange:
case QEvent::StyleChange: