diff options
author | Jens Bache-Wiig <jens.bache-wiig@nokia.com> | 2011-10-13 12:37:36 (GMT) |
---|---|---|
committer | Qt Commercial Integration <QtCommercial@digia.com> | 2012-01-31 10:24:45 (GMT) |
commit | d8fe434e21c602e0c7ead29a670be065c41ad8e6 (patch) | |
tree | 63501e2774575847847a1851d26b08e8db5bfb63 | |
parent | 4d85c3d8b5925272831295eebddec50c38a4f425 (diff) | |
download | Qt-d8fe434e21c602e0c7ead29a670be065c41ad8e6.zip Qt-d8fe434e21c602e0c7ead29a670be065c41ad8e6.tar.gz Qt-d8fe434e21c602e0c7ead29a670be065c41ad8e6.tar.bz2 |
Fix regression in ListView
This reverts commit d91a8f3a5dbcf3e4c4c0afb28463b25e192b00e4
and introduces a minimal fix for the original crash report.
Task-number: QTBUG-21433
Reviewed-by: gabriel
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 2019f82..e64bebe 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1481,7 +1481,7 @@ void QListView::doItemsLayout() void QListView::updateGeometries() { Q_D(QListView); - if (d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) { + if (geometry().isEmpty() || d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) { horizontalScrollBar()->setRange(0, 0); verticalScrollBar()->setRange(0, 0); } else { @@ -1496,15 +1496,15 @@ void QListView::updateGeometries() // if the scroll bars are turned off, we resize the contents to the viewport if (d->movement == Static && !d->isWrapping()) { - const QSize maxSize = maximumViewportSize(); + d->layoutChildren(); // we need the viewport size to be updated if (d->flow == TopToBottom) { if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(maxSize.width(), contentsSize().height()); + d->setContentsSize(viewport()->width(), contentsSize().height()); horizontalScrollBar()->setRange(0, 0); // we see all the contents anyway } } else { // LeftToRight if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(contentsSize().width(), maxSize.height()); + d->setContentsSize(contentsSize().width(), viewport()->height()); verticalScrollBar()->setRange(0, 0); // we see all the contents anyway } } |