summaryrefslogtreecommitdiffstats
path: root/common/modelresult.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-27 10:20:03 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-27 10:20:03 +0200
commit9f26558b138f9a8dba7620ecb611882f724eed40 (patch)
tree7915e2fe60402ea443525756f4072b6432bf1895 /common/modelresult.cpp
parentb4ba2aed63e979670ef9931546a7118daadd48b5 (diff)
downloadsink-9f26558b138f9a8dba7620ecb611882f724eed40.tar.gz
sink-9f26558b138f9a8dba7620ecb611882f724eed40.zip
Avoid fetching repeatedly to check for children.
canFetchMore returns true once the fetch is complete to allow the incremental fetch behaviour. When we check for children we really only want to fetch once though, otherwise we risk fetching over and over.
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r--common/modelresult.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp
index add84aa..d016978 100644
--- a/common/modelresult.cpp
+++ b/common/modelresult.cpp
@@ -154,7 +154,8 @@ bool ModelResult<T, Ptr>::hasChildren(const QModelIndex &parent) const
154 return false; 154 return false;
155 } 155 }
156 //Figure out whether we have children 156 //Figure out whether we have children
157 if (canFetchMore(parent)) { 157 const auto id = parent.internalId();
158 if (!mEntityChildrenFetched.contains(id)) {
158 //Since we don't retrieve that information as part of the entity, 159 //Since we don't retrieve that information as part of the entity,
159 //we have to query for the children to see if we have some 160 //we have to query for the children to see if we have some
160 auto p = const_cast<ModelResult<T, Ptr>*>(this); 161 auto p = const_cast<ModelResult<T, Ptr>*>(this);