summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qlistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemviews/qlistview.cpp')
-rw-r--r--src/gui/itemviews/qlistview.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 1869093..76d7642 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -2782,7 +2782,10 @@ QPoint QIconModeViewBase::initDynamicLayout(const QListViewLayoutInfo &info)
y = info.bounds.y() + info.spacing;
items.reserve(rowCount() - hiddenCount());
} else {
- const QListViewItem item = items.at(info.first - 1);
+ int idx = info.first - 1;
+ while (idx > 0 && !items.at(idx).isValid())
+ --idx;
+ const QListViewItem &item = items.at(idx);
x = item.x;
y = item.y;
if (info.flow == QListView::LeftToRight)
@@ -2913,6 +2916,8 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info)
else
contentsSize.rwidth() += info.spacing;
}
+ if (rect.size().isEmpty())
+ return;
// resize tree
int insertFrom = info.first;
if (done || info.first == 0) {