Files
DbSketch/sketchlib/container/sharedtextstylecontainer.cpp
2018-09-16 06:05:23 +02:00

35 lines
820 B
C++

#include "sharedtextstylecontainer.h"
#include <QJsonValue>
#include <QJsonObject>
#include <QJsonArray>
#include "containerfactory.h"
#include "sharedstyle.h"
SharedTextStyleContainer::SharedTextStyleContainer(QObject *parent) :
BaseContainer(parent)
{
}
const QList<SharedStyle *> &SharedTextStyleContainer::objects() const
{
return m_objects;
}
bool SharedTextStyleContainer::parseProperty(const QString &key, const QJsonValue &value)
{
if(key == QStringLiteral("objects"))
{
Q_ASSERT(value.isArray());
for(auto objectValue : value.toArray())
{
Q_ASSERT(objectValue.isObject());
m_objects.append(ContainerFactory::createContainer<SharedStyle>(objectValue.toObject(), this));
}
}
return BaseContainer::parseProperty(key, value);
}