diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-25 09:37:59 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-25 09:37:59 +0100 |
commit | a4acb7e251cba5ba6d66bf6235736202255c4eac (patch) | |
tree | aff6b7d7d852959bb4767809d3911d18b4ae3269 /common/modelresult.cpp | |
parent | 00e6b843e9f2881faccb312594a0e91c42df0096 (diff) | |
download | sink-a4acb7e251cba5ba6d66bf6235736202255c4eac.tar.gz sink-a4acb7e251cba5ba6d66bf6235736202255c4eac.zip |
Only use the parent index when it's available
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r-- | common/modelresult.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp index 4102cda..935e2e8 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp | |||
@@ -27,7 +27,8 @@ | |||
27 | template<class T, class Ptr> | 27 | template<class T, class Ptr> |
28 | ModelResult<T, Ptr>::ModelResult(const Akonadi2::Query &query, const QList<QByteArray> &propertyColumns) | 28 | ModelResult<T, Ptr>::ModelResult(const Akonadi2::Query &query, const QList<QByteArray> &propertyColumns) |
29 | :QAbstractItemModel(), | 29 | :QAbstractItemModel(), |
30 | mPropertyColumns(propertyColumns) | 30 | mPropertyColumns(propertyColumns), |
31 | mQuery(query) | ||
31 | { | 32 | { |
32 | } | 33 | } |
33 | 34 | ||
@@ -42,7 +43,10 @@ static qint64 getIdentifier(const QModelIndex &idx) | |||
42 | template<class T, class Ptr> | 43 | template<class T, class Ptr> |
43 | qint64 ModelResult<T, Ptr>::parentId(const Ptr &value) | 44 | qint64 ModelResult<T, Ptr>::parentId(const Ptr &value) |
44 | { | 45 | { |
45 | return qHash(value->getProperty("parent").toByteArray()); | 46 | if (!mQuery.parentProperty.isEmpty()) { |
47 | return qHash(value->getProperty(mQuery.parentProperty).toByteArray()); | ||
48 | } | ||
49 | return qHash(QByteArray()); | ||
46 | } | 50 | } |
47 | 51 | ||
48 | template<class T, class Ptr> | 52 | template<class T, class Ptr> |