2018-05-16 05:02:12 +00:00
|
|
|
#include "DataModel.h"
|
|
|
|
|
2018-05-18 17:51:48 +00:00
|
|
|
DataModel::DataModel(QObject *parent)
|
|
|
|
: QObject(parent)
|
|
|
|
, m_metaData(this)
|
2018-05-16 05:02:12 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataModel::write(QJsonObject &target) const
|
|
|
|
{
|
|
|
|
QJsonObject metaData;
|
|
|
|
m_metaData.write(metaData);
|
|
|
|
target["MetaData"] = metaData;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataModel::read(const QJsonObject &source)
|
|
|
|
{
|
|
|
|
const auto &metaData = source["MetaData"];
|
|
|
|
if (metaData.isObject())
|
|
|
|
{
|
|
|
|
m_metaData.read(metaData.toObject());
|
|
|
|
}
|
|
|
|
}
|