summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-04 11:59:07 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-04 11:59:07 +0100
commit52f14f40f233146f76a3c1eb143deb12c6a5b2d6 (patch)
tree8059c0bc52e51c218307c28738e4844006af5a4c
parentd2305f14fced3afdbda2b5a8f2a270ae91d79ae1 (diff)
downloadsink-52f14f40f233146f76a3c1eb143deb12c6a5b2d6.tar.gz
sink-52f14f40f233146f76a3c1eb143deb12c6a5b2d6.zip
Provide a way to get to the ApplicationDomainType base class
QVariant doesn't support polymorphism for non-QObject classes.
-rw-r--r--common/clientapi.h3
-rw-r--r--common/modelresult.cpp4
-rw-r--r--common/modelresult.h3
3 files changed, 8 insertions, 2 deletions
diff --git a/common/clientapi.h b/common/clientapi.h
index edf42e4..074aabc 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -45,7 +45,8 @@ public:
45 45
46 enum Roles { 46 enum Roles {
47 DomainObjectRole = Qt::UserRole + 1, //Must be the same as in ModelResult 47 DomainObjectRole = Qt::UserRole + 1, //Must be the same as in ModelResult
48 ChildrenFetchedRole 48 ChildrenFetchedRole,
49 DomainObjectBaseRole
49 }; 50 };
50 51
51 /** 52 /**
diff --git a/common/modelresult.cpp b/common/modelresult.cpp
index c7fcd49..4fd8d97 100644
--- a/common/modelresult.cpp
+++ b/common/modelresult.cpp
@@ -71,6 +71,10 @@ QVariant ModelResult<T, Ptr>::data(const QModelIndex &index, int role) const
71 Q_ASSERT(mEntities.contains(index.internalId())); 71 Q_ASSERT(mEntities.contains(index.internalId()));
72 return QVariant::fromValue(mEntities.value(index.internalId())); 72 return QVariant::fromValue(mEntities.value(index.internalId()));
73 } 73 }
74 if (role == DomainObjectBaseRole) {
75 Q_ASSERT(mEntities.contains(index.internalId()));
76 return QVariant::fromValue(mEntities.value(index.internalId()). template staticCast<Akonadi2::ApplicationDomain::ApplicationDomainType>());
77 }
74 if (role == ChildrenFetchedRole) { 78 if (role == ChildrenFetchedRole) {
75 return childrenFetched(index); 79 return childrenFetched(index);
76 } 80 }
diff --git a/common/modelresult.h b/common/modelresult.h
index 700064b..298e157 100644
--- a/common/modelresult.h
+++ b/common/modelresult.h
@@ -34,7 +34,8 @@ class ModelResult : public QAbstractItemModel
34public: 34public:
35 enum Roles { 35 enum Roles {
36 DomainObjectRole = Qt::UserRole + 1, 36 DomainObjectRole = Qt::UserRole + 1,
37 ChildrenFetchedRole 37 ChildrenFetchedRole,
38 DomainObjectBaseRole
38 }; 39 };
39 40
40 ModelResult(const Akonadi2::Query &query, const QList<QByteArray> &propertyColumns); 41 ModelResult(const Akonadi2::Query &query, const QList<QByteArray> &propertyColumns);