Moved the model meta data for roles and columns into "model/metadata.h" to gather meta data like this in one central place.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#include "modelitem.h"
|
||||
|
||||
#include "tablemodel.h"
|
||||
#include "metadata.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
@ -48,16 +48,11 @@ QJsonObject ModelItem::toJsonObject() const {
|
||||
QJsonObject itemObject;
|
||||
// itemObject.insert("uuid", m_uuid.toString());
|
||||
// itemObject.insert("entryDateUTC", m_entryDateUTC.toString(Qt::ISODate));
|
||||
itemObject.insert(TableModel::ROLE_NAMES.value(TableModel::NameRole),
|
||||
data(TableModel::NameRole).toString());
|
||||
itemObject.insert(TableModel::ROLE_NAMES.value(TableModel::DescriptionRole),
|
||||
data(TableModel::DescriptionRole).toString());
|
||||
itemObject.insert(TableModel::ROLE_NAMES.value(TableModel::InfoRole),
|
||||
data(TableModel::InfoRole).toString());
|
||||
itemObject.insert(TableModel::ROLE_NAMES.value(TableModel::AmountRole),
|
||||
data(TableModel::AmountRole).toInt());
|
||||
itemObject.insert(TableModel::ROLE_NAMES.value(TableModel::FactorRole),
|
||||
data(TableModel::FactorRole).toReal());
|
||||
itemObject.insert(ROLE_NAMES.value(NameRole), data(NameRole).toString());
|
||||
itemObject.insert(ROLE_NAMES.value(DescriptionRole), data(DescriptionRole).toString());
|
||||
itemObject.insert(ROLE_NAMES.value(InfoRole), data(InfoRole).toString());
|
||||
itemObject.insert(ROLE_NAMES.value(AmountRole), data(AmountRole).toInt());
|
||||
itemObject.insert(ROLE_NAMES.value(FactorRole), data(FactorRole).toReal());
|
||||
|
||||
// if (m_modifiedDateUTC.isValid()) {
|
||||
// itemObject.insert("modifiedDateUTC", m_modifiedDateUTC.toString(Qt::ISODate));
|
||||
|
||||
Reference in New Issue
Block a user