101 lines
2.0 KiB
C++
101 lines
2.0 KiB
C++
#include "baseProperty.h"
|
|
#include "dataManager.h"
|
|
#include <QJsonArray>
|
|
|
|
|
|
AbstractProperty::AbstractProperty(QObject* parent)
|
|
: QObject(parent)
|
|
{
|
|
|
|
}
|
|
AbstractProperty::~AbstractProperty()
|
|
{
|
|
|
|
}
|
|
|
|
QJsonArray AbstractProperty::saveSubToJsonArr()
|
|
{
|
|
QJsonArray jsonArray;
|
|
|
|
for (const auto& pair : subList) {
|
|
QJsonObject itemObject;
|
|
itemObject["category"] = pair.first;
|
|
itemObject["uuid"] = pair.second.toString(); // 将QUuid转换为字符串
|
|
|
|
jsonArray.append(itemObject);
|
|
}
|
|
return jsonArray;
|
|
}
|
|
|
|
/******************************模型基类*******************************/
|
|
ModelProperty::ModelProperty(QObject* parent)
|
|
:AbstractProperty(parent)
|
|
{
|
|
_dataChanged = false;
|
|
_prepareDelete = false;
|
|
|
|
}
|
|
ModelProperty::~ModelProperty()
|
|
{
|
|
|
|
}
|
|
|
|
/*****************************组态编辑预览item*********************************/
|
|
DiagramEditorItemProperty::DiagramEditorItemProperty(QObject* parent)
|
|
:ModelProperty(parent)
|
|
{
|
|
|
|
}
|
|
DiagramEditorItemProperty::~DiagramEditorItemProperty()
|
|
{
|
|
|
|
}
|
|
|
|
/*****************************基模*********************************/
|
|
BaseModelProperty::BaseModelProperty(QObject* parent)
|
|
: ModelProperty(parent)
|
|
{
|
|
|
|
}
|
|
BaseModelProperty::~BaseModelProperty()
|
|
{
|
|
|
|
}
|
|
/****************************工程模****************************/
|
|
|
|
BaseProperty::BaseProperty(QObject* parent)
|
|
: ModelProperty(parent)
|
|
{
|
|
nType = 0; //设备类型
|
|
bInService = true;
|
|
nState = 1;
|
|
nStatus = 1;
|
|
|
|
sGrid=QString("1"); //暂时修改,数据库字段不为空
|
|
sZone=QString("1");
|
|
sStation=QString("1");
|
|
}
|
|
|
|
BaseProperty::~BaseProperty()
|
|
{
|
|
//qDebug()<<"release by "<<uuid();
|
|
}
|
|
|
|
/*************************属性变量*************************/
|
|
|
|
VariableProperty::VariableProperty(QObject* parent)
|
|
:BaseProperty(parent)
|
|
{
|
|
|
|
}
|
|
|
|
VariableProperty::~VariableProperty()
|
|
{
|
|
|
|
}
|
|
|
|
modelDataInfo& VariableProperty::getPropertyValue() const
|
|
{
|
|
return DataManager::instance().modelData()[sModelName];
|
|
}
|