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

43 lines
792 B
C++

#include "sharedstyle.h"
#include <QJsonValue>
#include <QJsonObject>
#include "containerfactory.h"
#include "style.h"
SharedStyle::SharedStyle(QObject *parent) :
BaseContainer(parent)
{
}
const QString &SharedStyle::name() const
{
return m_name;
}
Style *SharedStyle::value() const
{
return m_value;
}
bool SharedStyle::parseProperty(const QString &key, const QJsonValue &value)
{
if(key == QStringLiteral("name"))
{
Q_ASSERT(value.isString());
m_name = value.toString();
return true;
}
if(key == QStringLiteral("value"))
{
Q_ASSERT(value.isObject());
m_value = ContainerFactory::createContainer<Style>(value.toObject(), this);
return true;
}
return BaseContainer::parseProperty(key, value);
}