From 4d85c3d8b5925272831295eebddec50c38a4f425 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 13 Oct 2010 14:22:52 +0200 Subject: Fixed a possible crash when resizing QListView The problem is that the layout code was called recursively because the visibility of the scroll bars was constently changed. Task-Number: QTBUG-14412 Reviewed-By: ogoffart --- src/gui/itemviews/qlistview.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 8c83642..2019f82 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1496,19 +1496,20 @@ void QListView::updateGeometries() // if the scroll bars are turned off, we resize the contents to the viewport if (d->movement == Static && !d->isWrapping()) { - d->layoutChildren(); // we need the viewport size to be updated + const QSize maxSize = maximumViewportSize(); if (d->flow == TopToBottom) { if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(viewport()->width(), contentsSize().height()); + d->setContentsSize(maxSize.width(), contentsSize().height()); horizontalScrollBar()->setRange(0, 0); // we see all the contents anyway } } else { // LeftToRight if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(contentsSize().width(), viewport()->height()); + d->setContentsSize(contentsSize().width(), maxSize.height()); verticalScrollBar()->setRange(0, 0); // we see all the contents anyway } } } + } /*! -- cgit v0.12