diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-19 09:37:42 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-19 09:37:42 +0100 |
commit | ef205affdb73bfdbef5830996e6336e583660fbc (patch) | |
tree | aba43d38e6ea9a2b48a6818978bad123fbb5bcc0 /common/modelresult.h | |
parent | b42047ad90470ecab329375fdacff03564c80074 (diff) | |
download | sink-ef205affdb73bfdbef5830996e6336e583660fbc.tar.gz sink-ef205affdb73bfdbef5830996e6336e583660fbc.zip |
Use the new modelresult in the dummyclient
Diffstat (limited to 'common/modelresult.h')
-rw-r--r-- | common/modelresult.h | 11 |
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 | ||