summaryrefslogtreecommitdiffstats
path: root/common/modelresult.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 13:45:51 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 13:45:51 +0100
commitbf28c2e3f43038165dc83c10267d103e779b245e (patch)
tree1b69c51550f10e579309a81f109574b43eda850f /common/modelresult.cpp
parent32a6d2f881bb6d12a4ab685b7bb3fb10c3bdf72c (diff)
downloadsink-bf28c2e3f43038165dc83c10267d103e779b245e.tar.gz
sink-bf28c2e3f43038165dc83c10267d103e779b245e.zip
ModelResult: return an invalid QModelIndex for the toplevel parent
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r--common/modelresult.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp
index 4def20f..e2a05f8 100644
--- a/common/modelresult.cpp
+++ b/common/modelresult.cpp
@@ -100,6 +100,9 @@ QModelIndex ModelResult<T, Ptr>::index(int row, int column, const QModelIndex &p
100template<class T, class Ptr> 100template<class T, class Ptr>
101QModelIndex ModelResult<T, Ptr>::createIndexFromId(const qint64 &id) const 101QModelIndex ModelResult<T, Ptr>::createIndexFromId(const qint64 &id) const
102{ 102{
103 if (id == 0) {
104 return QModelIndex();
105 }
103 auto grandParentId = mParents.value(id, 0); 106 auto grandParentId = mParents.value(id, 0);
104 auto row = mTree.value(grandParentId).indexOf(id); 107 auto row = mTree.value(grandParentId).indexOf(id);
105 return createIndex(row, 0, id); 108 return createIndex(row, 0, id);