diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-11 12:04:38 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-13 19:42:39 +0100 |
commit | 720079d6a839b4d03eb0ceaa06d0ad2b446f7de1 (patch) | |
tree | 83ca22e1ef489a4ef7b7de7395c58130bb9ecf7f /common/modelresult.cpp | |
parent | 1259b236704e790fa1284a63ec537525bce23841 (diff) | |
download | sink-720079d6a839b4d03eb0ceaa06d0ad2b446f7de1.tar.gz sink-720079d6a839b4d03eb0ceaa06d0ad2b446f7de1.zip |
Don't emit superfluous remove signals.
We often let removal updates through and expect the model to deal with
superfluous updates, this now actually implements that.
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r-- | common/modelresult.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp index 0825518..f935419 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp | |||
@@ -228,12 +228,14 @@ void ModelResult<T, Ptr>::remove(const Ptr &value) | |||
228 | auto parent = createIndexFromId(id); | 228 | auto parent = createIndexFromId(id); |
229 | SinkTraceCtx(mLogCtx) << "Removed entity" << childId; | 229 | SinkTraceCtx(mLogCtx) << "Removed entity" << childId; |
230 | auto index = mTree[id].indexOf(childId); | 230 | auto index = mTree[id].indexOf(childId); |
231 | beginRemoveRows(parent, index, index); | 231 | if (index >= 0) { |
232 | mEntities.remove(childId); | 232 | beginRemoveRows(parent, index, index); |
233 | mTree[id].removeAll(childId); | 233 | mEntities.remove(childId); |
234 | mParents.remove(childId); | 234 | mTree[id].removeAll(childId); |
235 | // TODO remove children | 235 | mParents.remove(childId); |
236 | endRemoveRows(); | 236 | // TODO remove children |
237 | endRemoveRows(); | ||
238 | } | ||
237 | } | 239 | } |
238 | 240 | ||
239 | template <class T, class Ptr> | 241 | template <class T, class Ptr> |