From 9f26558b138f9a8dba7620ecb611882f724eed40 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 27 Oct 2016 10:20:03 +0200 Subject: 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. --- common/modelresult.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common') 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::hasChildren(const QModelIndex &parent) const return false; } //Figure out whether we have children - if (canFetchMore(parent)) { + const auto id = parent.internalId(); + if (!mEntityChildrenFetched.contains(id)) { //Since we don't retrieve that information as part of the entity, //we have to query for the children to see if we have some auto p = const_cast*>(this); -- cgit v1.2.3