summaryrefslogtreecommitdiffstats
path: root/common/modelresult.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-19 09:37:42 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-19 09:37:42 +0100
commitef205affdb73bfdbef5830996e6336e583660fbc (patch)
treeaba43d38e6ea9a2b48a6818978bad123fbb5bcc0 /common/modelresult.h
parentb42047ad90470ecab329375fdacff03564c80074 (diff)
downloadsink-ef205affdb73bfdbef5830996e6336e583660fbc.tar.gz
sink-ef205affdb73bfdbef5830996e6336e583660fbc.zip
Use the new modelresult in the dummyclient
Diffstat (limited to 'common/modelresult.h')
-rw-r--r--common/modelresult.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/common/modelresult.h b/common/modelresult.h
index 8ca6daa..3b45955 100644
--- a/common/modelresult.h
+++ b/common/modelresult.h
@@ -63,11 +63,18 @@ public:
63 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const 63 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
64 { 64 {
65 if (role == DomainObjectRole) { 65 if (role == DomainObjectRole) {
66 qWarning() << "trying to get entity " << index.internalId();
67 Q_ASSERT(mEntities.contains(index.internalId())); 66 Q_ASSERT(mEntities.contains(index.internalId()));
68 return QVariant::fromValue(mEntities.value(index.internalId())); 67 return QVariant::fromValue(mEntities.value(index.internalId()));
69 } 68 }
70 qDebug() << "Invalid role"; 69 if (role == Qt::DisplayRole) {
70 if (index.column() < mPropertyColumns.size()) {
71 Q_ASSERT(mEntities.contains(index.internalId()));
72 auto entity = mEntities.value(index.internalId());
73 return entity->getProperty(mPropertyColumns.at(index.column())).toString();
74 } else {
75 return "No data available";
76 }
77 }
71 return QVariant(); 78 return QVariant();
72 } 79 }
73 80