From 6625bb5a2145008ad47ae963e1546714b7342bf0 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 20 Dec 2016 09:34:12 +0100 Subject: Return false once we cannot fetch more --- common/modelresult.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'common') diff --git a/common/modelresult.cpp b/common/modelresult.cpp index ed77ebb..34e6dfc 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp @@ -167,7 +167,7 @@ template bool ModelResult::canFetchMore(const QModelIndex &parent) const { const auto id = parent.internalId(); - return !mEntityChildrenFetched.contains(id) || mEntityChildrenFetchComplete.contains(id); + return !mEntityChildrenFetched.contains(id) || !mEntityChildrenFetchComplete.contains(id); } template @@ -187,8 +187,12 @@ void ModelResult::add(const Ptr &value) SinkTrace() << "Too early" << id; return; } + if (mEntities.contains(childId)) { + SinkWarning() << "Entity already in model: " << value->identifier(); + return; + } auto parent = createIndexFromId(id); - SinkTrace() << "Added entity " << childId << value->identifier() << id; + SinkTrace() << "Added entity " << childId << "id: " << value->identifier() << "parent: " << id; const auto keys = mTree[id]; int index = 0; for (; index < keys.size(); index++) { @@ -196,10 +200,6 @@ void ModelResult::add(const Ptr &value) break; } } - if (mEntities.contains(childId)) { - SinkWarning() << "Entity already in model " << value->identifier(); - return; - } // SinkTrace() << "Inserting rows " << index << parent; beginInsertRows(parent, index, index); mEntities.insert(childId, value); -- cgit v1.2.3