QHeaderView - minor cleanup in viewportEvent

This is an improvement to a previous fix with
SHA e62e71162606fec134600955a89b7e0c34a7840b

We actually never want to call resizeSections if the parent is hidden.
Therefore we can both simplify and improve the code with this patch.

When we do show/hide on parent then the visible status is updated
before we get into this code. I have verified the patch on the code
from:

Task-number: QTBUG-14234

Change-Id: If7bfa3b3813c97b4a545e48423526e9cfe118de4
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Thorbjørn Lund Martsum 2012-02-23 08:24:21 +01:00 committed by Qt by Nokia
parent e2f295e27c
commit 05e24901a1

View File

@ -2433,20 +2433,15 @@ bool QHeaderView::viewportEvent(QEvent *e)
}
return true; }
#endif // QT_NO_STATUSTIP
case QEvent::Hide: {
d->invalidateCachedSizeHint();
case QEvent::Hide:
case QEvent::Show:
case QEvent::FontChange:
case QEvent::StyleChange:{
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:
d->invalidateCachedSizeHint();
resizeSections();
emit geometriesChanged();
break;
case QEvent::ContextMenu: {
d->state = QHeaderViewPrivate::NoState;
d->pressed = d->section = d->target = -1;