summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 3fd0da37cf..f3e0e06a56 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3348,8 +3348,12 @@ void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninit
// guestimate the number of items in the viewport, and fetch as many as might fit
const int itemHeight = defaultItemHeight <= 0 ? q->sizeHintForRow(0) : defaultItemHeight;
const int viewCount = viewport->height() / itemHeight;
- while ((count = model->rowCount(parent)) < viewCount && model->canFetchMore(parent))
+ int lastCount = -1;
+ while ((count = model->rowCount(parent)) < viewCount &&
+ count != lastCount && model->canFetchMore(parent)) {
model->fetchMore(parent);
+ lastCount = count;
+ }
} else {
count = model->rowCount(parent);
}