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.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index d2fec21..48f53a0 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1997,14 +1997,15 @@ bool QListViewPrivate::doItemsLayout(int delta)
int first = batchStartRow();
int last = qMin(first + delta - 1, max);
- if (max < 0 || last < first)
- return true; // nothing to do
-
if (first == 0) {
layoutChildren(); // make sure the viewport has the right size
prepareItemsLayout();
}
+ if (max < 0 || last < first) {
+ return true; // nothing to do
+ }
+
QListViewLayoutInfo info;
info.bounds = layoutBounds;
info.grid = gridSize();
@@ -2854,7 +2855,7 @@ void QDynamicListViewBase::addLeaf(QVector<int> &leaf, const QRect &area,
continue;
vi = &_this->dynamicListView->items[idx];
Q_ASSERT(vi);
- if (vi->rect().intersects(area) && vi->visited != visited) {
+ if (vi->isValid() && vi->rect().intersects(area) && vi->visited != visited) {
QModelIndex index = _this->listViewItemToIndex(*vi);
Q_ASSERT(index.isValid());
_this->intersectVector.append(index);