diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-10-13 12:22:52 (GMT) |
---|---|---|
committer | Qt Commercial Integration <QtCommercial@digia.com> | 2012-01-31 10:24:45 (GMT) |
commit | 4d85c3d8b5925272831295eebddec50c38a4f425 (patch) | |
tree | f41bad0b338792cbc2498d5bf8b5912ed015d31c /src | |
parent | c49bf50c8e603e6986ebc329e7776233483e98ab (diff) | |
download | Qt-4d85c3d8b5925272831295eebddec50c38a4f425.zip Qt-4d85c3d8b5925272831295eebddec50c38a4f425.tar.gz Qt-4d85c3d8b5925272831295eebddec50c38a4f425.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 7 |
1 files 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 } } } + } /*! |