diff options
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 | ||