diff options
author | Jens Bache-Wiig <jens.bache-wiig@nokia.com> | 2011-10-13 12:37:36 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jens.bache-wiig@nokia.com> | 2011-10-13 13:11:56 (GMT) |
commit | 4c64464ddf63ed89603ad759ffb68c6f298edd26 (patch) | |
tree | 0d41be15ab7eca2789bb405ecb477082539547b1 /src/gui/itemviews | |
parent | 3e7056ad406d59eb4a052f02f82ba92ab474ea0e (diff) | |
download | Qt-4c64464ddf63ed89603ad759ffb68c6f298edd26.zip Qt-4c64464ddf63ed89603ad759ffb68c6f298edd26.tar.gz Qt-4c64464ddf63ed89603ad759ffb68c6f298edd26.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
Diffstat (limited to 'src/gui/itemviews')
-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 a0955d2..01a9eec 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1475,7 +1475,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 { @@ -1490,15 +1490,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 } } |