version 0.5
This commit is contained in:
parent
a5259319f7
commit
b39b15d551
|
|
@ -55,6 +55,7 @@ set(H_HEADER_FILES
|
||||||
common/include/global.h
|
common/include/global.h
|
||||||
common/include/tools.h
|
common/include/tools.h
|
||||||
common/include/httpInterface.h
|
common/include/httpInterface.h
|
||||||
|
common/include/baseProperty.h
|
||||||
common/include/compiler.hpp
|
common/include/compiler.hpp
|
||||||
common/include/export.hpp
|
common/include/export.hpp
|
||||||
common/include/operatingSystem.hpp
|
common/include/operatingSystem.hpp
|
||||||
|
|
@ -81,6 +82,7 @@ set(CPP_SOURCE_FILES
|
||||||
common/source/httpInterface.cpp
|
common/source/httpInterface.cpp
|
||||||
common/source/global.cpp
|
common/source/global.cpp
|
||||||
common/source/tools.cpp
|
common/source/tools.cpp
|
||||||
|
common/source/baseProperty.cpp
|
||||||
)
|
)
|
||||||
set(UI_FILES
|
set(UI_FILES
|
||||||
ui/mainwindow.ui
|
ui/mainwindow.ui
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
#ifndef BASEPROPERTY_H
|
||||||
|
#define BASEPROPERTY_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
class BaseProperty:public QObject //属性类,存放电路元件属性
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
BaseProperty(QObject* parent);
|
||||||
|
virtual ~BaseProperty();
|
||||||
|
|
||||||
|
void setUuid(QUuid id) {uUid = id;}
|
||||||
|
QUuid uuid() const {return uUid;}
|
||||||
|
void setModelName(QString sName) {sModelName = sName;}
|
||||||
|
QString modelName() const {return sModelName;}
|
||||||
|
void setType(int n) {nType = n;}
|
||||||
|
int type() const {return nType;}
|
||||||
|
void setTag(QString s){sTag = s;}
|
||||||
|
QString tag() const {return sTag;}
|
||||||
|
void setName(QString s){sName = s;}
|
||||||
|
QString name() const {return sName;}
|
||||||
|
void setPath(QString s){sPath = s;}
|
||||||
|
QString path() const {return sPath;}
|
||||||
|
void setDescription(QString s) {sDescription = s;}
|
||||||
|
QString description() const {return sDescription;}
|
||||||
|
void setInService(bool b) {bInService = b;}
|
||||||
|
bool inService() {return bInService;}
|
||||||
|
void setState(int n) {nState = n;}
|
||||||
|
int state() const {return nState;}
|
||||||
|
void setStatus(int n) {nStatus = n;}
|
||||||
|
int status() const {return nStatus;}
|
||||||
|
void setConnectedBus(QJsonObject j) {jConnectedBus = j;}
|
||||||
|
QJsonObject connectedBus() const {return jConnectedBus;}
|
||||||
|
void setLabel(QJsonObject j){jLabel = j;}
|
||||||
|
QJsonObject label() const {return jLabel;}
|
||||||
|
void setContext(QJsonObject j){jContext = j;}
|
||||||
|
QJsonObject context() const {return jContext;}
|
||||||
|
void setGrid(const QString& s) {sGrid = s;}
|
||||||
|
QString grid() const {return sGrid;}
|
||||||
|
void setZone(const QString& s) {sZone = s;}
|
||||||
|
QString zone() const {return sZone;}
|
||||||
|
void setStation(const QString& s) {sStation = s;}
|
||||||
|
QString station() const {return sStation;}
|
||||||
|
|
||||||
|
void setPrepareDelete(bool b) {_prepareDelete = b;}
|
||||||
|
bool prepareDelete() const {return _prepareDelete;}
|
||||||
|
void setDataChanged(bool b) {_dataChanged = b;} //数据变换标签
|
||||||
|
bool dataChanged() const {return _dataChanged;}
|
||||||
|
void notifyUpdate(){emit updateData();}
|
||||||
|
signals:
|
||||||
|
void updateData(); //通知数据拥有者更新
|
||||||
|
protected:
|
||||||
|
QUuid uUid;
|
||||||
|
QString sModelName; //模型名
|
||||||
|
int nType; //设备类型
|
||||||
|
QString sTag;
|
||||||
|
QString sName;
|
||||||
|
QString sPath;
|
||||||
|
QString sDescription;
|
||||||
|
QString sGrid;
|
||||||
|
QString sZone;
|
||||||
|
QString sStation;
|
||||||
|
bool bInService;
|
||||||
|
int nState;
|
||||||
|
int nStatus;
|
||||||
|
QJsonObject jConnectedBus;
|
||||||
|
QJsonObject jLabel;
|
||||||
|
QJsonObject jContext; //存放port信息
|
||||||
|
|
||||||
|
bool _dataChanged; //数据状态,为真则写入库
|
||||||
|
bool _prepareDelete; //状态,为真准备删除
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef QMap<QString,QVariant> VariableMap; //属性名,值
|
||||||
|
|
||||||
|
class VariableProperty:public BaseProperty //收到的变量数据
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
VariableProperty(QObject* parent);
|
||||||
|
~VariableProperty();
|
||||||
|
|
||||||
|
modelDataInfo getPropertyValue() const;
|
||||||
|
};
|
||||||
|
#endif // DATABASE_H
|
||||||
|
|
@ -68,6 +68,7 @@ enum Attribute //元模属性字段对照
|
||||||
IsNotNull = Qt::UserRole + 7,
|
IsNotNull = Qt::UserRole + 7,
|
||||||
DefaultValue = Qt::UserRole + 8,
|
DefaultValue = Qt::UserRole + 8,
|
||||||
ValueRange = Qt::UserRole + 9,
|
ValueRange = Qt::UserRole + 9,
|
||||||
|
IsVisible = Qt::UserRole + 10
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TableDelegateContent //代理内容
|
enum TableDelegateContent //代理内容
|
||||||
|
|
@ -139,6 +140,7 @@ struct attribute //属性表(元模属性字段)
|
||||||
int isNotNull=0; //是否非空
|
int isNotNull=0; //是否非空
|
||||||
QString defaultValue; //默认值
|
QString defaultValue; //默认值
|
||||||
QString valueRange; //数值范围
|
QString valueRange; //数值范围
|
||||||
|
int isVisible = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct modelAttribute //模型属性表(所有模型属性的索引)
|
struct modelAttribute //模型属性表(所有模型属性的索引)
|
||||||
|
|
@ -195,6 +197,8 @@ struct propertyStateInfo //属性
|
||||||
int lengthPrecision = 999; //长度限制
|
int lengthPrecision = 999; //长度限制
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(propertyStateInfo);
|
||||||
|
|
||||||
typedef QMap<QString,propertyStateInfo> PropertyValueInfo;
|
typedef QMap<QString,propertyStateInfo> PropertyValueInfo;
|
||||||
|
|
||||||
struct groupStateInfo //属性组(结构信息)
|
struct groupStateInfo //属性组(结构信息)
|
||||||
|
|
@ -307,6 +311,23 @@ struct DiagramContent {
|
||||||
//QHash<QString, QColor> connectionColors; // <连接ID, 显示颜色>
|
//QHash<QString, QColor> connectionColors; // <连接ID, 显示颜色>
|
||||||
QHash<QString, QList<QPointF>> connectionPaths; // 自定义路径点
|
QHash<QString, QList<QPointF>> connectionPaths; // 自定义路径点
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PtExtraInfo
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
QString transRatio; //变比
|
||||||
|
QString accuracyClass; //精度等级
|
||||||
|
QString secondaryLoadCapacity; //二次负载容量
|
||||||
|
QString windingConnectionMethod; //绕组接法
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CtExtraInfo
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
QString transRatio; //变比
|
||||||
|
QString accuracyClass; //精度等级
|
||||||
|
QString secondaryLoadCapacity; //二次负载容量
|
||||||
|
};
|
||||||
//==================================================
|
//==================================================
|
||||||
|
|
||||||
struct componentInfo
|
struct componentInfo
|
||||||
|
|
@ -327,18 +348,16 @@ struct componentInfo
|
||||||
QJsonObject connected_bus;
|
QJsonObject connected_bus;
|
||||||
QJsonObject label;
|
QJsonObject label;
|
||||||
QJsonObject context;
|
QJsonObject context;
|
||||||
int page_id = 0;
|
|
||||||
int op = 0;
|
int op = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct topologicInfo
|
struct topologicInfo
|
||||||
{
|
{
|
||||||
int id = -1;
|
int id = -1;
|
||||||
int page_id;
|
|
||||||
QUuid uuid_from;
|
QUuid uuid_from;
|
||||||
QUuid uuid_to;
|
QUuid uuid_to;
|
||||||
QUuid pin_from;
|
QUuid from_pin;
|
||||||
QUuid pin_to;
|
QUuid to_pin;
|
||||||
int flag;
|
int flag;
|
||||||
QString description;
|
QString description;
|
||||||
int op;
|
int op;
|
||||||
|
|
@ -349,12 +368,36 @@ struct pageInfo
|
||||||
int id = -1;
|
int id = -1;
|
||||||
QString tag;
|
QString tag;
|
||||||
QString name;
|
QString name;
|
||||||
int status;
|
|
||||||
QJsonObject label;
|
QJsonObject label;
|
||||||
QJsonObject context;
|
QJsonObject context;
|
||||||
QString description;
|
QString description;
|
||||||
int op;
|
int op;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct gridInfo
|
||||||
|
{
|
||||||
|
int id = -1;
|
||||||
|
QString name;
|
||||||
|
QString description;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct zoneInfo
|
||||||
|
{
|
||||||
|
int id = -1;
|
||||||
|
int grid_id = -1;
|
||||||
|
QString name;
|
||||||
|
QString description;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct stationInfo
|
||||||
|
{
|
||||||
|
int id = -1;
|
||||||
|
int zone_id = -1;
|
||||||
|
QString name;
|
||||||
|
QString description;
|
||||||
|
bool is_local = true;
|
||||||
|
};
|
||||||
|
|
||||||
/*struct busStability
|
/*struct busStability
|
||||||
{
|
{
|
||||||
int componentId = 0;
|
int componentId = 0;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
#include "baseProperty.h"
|
||||||
|
#include "dataManager.h"
|
||||||
|
|
||||||
|
/****************************属性****************************/
|
||||||
|
|
||||||
|
BaseProperty::BaseProperty(QObject* parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
nType = 0; //设备类型
|
||||||
|
bInService = true;
|
||||||
|
nState = 1;
|
||||||
|
nStatus = 1;
|
||||||
|
|
||||||
|
_dataChanged = false;
|
||||||
|
_prepareDelete = false;
|
||||||
|
|
||||||
|
sGrid=QString("1"); //暂时修改,数据库字段不为空
|
||||||
|
sZone=QString("1");
|
||||||
|
sStation=QString("1");
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseProperty::~BaseProperty()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************属性变量*************************/
|
||||||
|
|
||||||
|
VariableProperty::VariableProperty(QObject* parent)
|
||||||
|
:BaseProperty(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VariableProperty::~VariableProperty()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
modelDataInfo VariableProperty::getPropertyValue() const
|
||||||
|
{
|
||||||
|
ModelDataMap mapData = DataManager::instance().modelData();
|
||||||
|
return mapData[sModelName];
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,8 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/topologyManager.h
|
include/topologyManager.h
|
||||||
include/baseInfoDlg.h
|
include/baseInfoDlg.h
|
||||||
include/baseContentDlg.h
|
include/baseContentDlg.h
|
||||||
|
include/ptExtraInfoDlg.h
|
||||||
|
include/ctExtraInfoDlg.h
|
||||||
include/graphicsDataModel/baseModel.h
|
include/graphicsDataModel/baseModel.h
|
||||||
include/graphicsDataModel/fixedPortsModel.h
|
include/graphicsDataModel/fixedPortsModel.h
|
||||||
include/graphicsItem/electricConnectLineItem.h
|
include/graphicsItem/electricConnectLineItem.h
|
||||||
|
|
@ -43,6 +45,7 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/util/subMovingSelector.h
|
include/util/subMovingSelector.h
|
||||||
../common/include/httpInterface.h
|
../common/include/httpInterface.h
|
||||||
../common/include/global.h
|
../common/include/global.h
|
||||||
|
../common/include/baseProperty.h
|
||||||
../common/include/compiler.hpp
|
../common/include/compiler.hpp
|
||||||
../common/include/export.hpp
|
../common/include/export.hpp
|
||||||
../common/include/operatingSystem.hpp
|
../common/include/operatingSystem.hpp
|
||||||
|
|
@ -63,7 +66,8 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/topologyManager.cpp
|
source/topologyManager.cpp
|
||||||
source/baseInfoDlg.cpp
|
source/baseInfoDlg.cpp
|
||||||
source/baseContentDlg.cpp
|
source/baseContentDlg.cpp
|
||||||
#source/serializable.cpp
|
source/ptExtraInfoDlg.cpp
|
||||||
|
source/ctExtraInfoDlg.cpp
|
||||||
source/graphicsDataModel/baseModel.cpp
|
source/graphicsDataModel/baseModel.cpp
|
||||||
source/graphicsDataModel/fixedPortsModel.cpp
|
source/graphicsDataModel/fixedPortsModel.cpp
|
||||||
source/graphicsItem/electricConnectLineItem.cpp
|
source/graphicsItem/electricConnectLineItem.cpp
|
||||||
|
|
@ -90,12 +94,15 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/util/selectorManager.cpp
|
source/util/selectorManager.cpp
|
||||||
source/util/subMovingSelector.cpp
|
source/util/subMovingSelector.cpp
|
||||||
../common/source/httpInterface.cpp
|
../common/source/httpInterface.cpp
|
||||||
|
../common/source/baseProperty.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(UI_FILES
|
set(UI_FILES
|
||||||
ui/drawingPanel.ui
|
ui/drawingPanel.ui
|
||||||
ui/itemPropertyDlg.ui
|
ui/itemPropertyDlg.ui
|
||||||
ui/baseInfoDlg.ui
|
ui/baseInfoDlg.ui
|
||||||
|
ui/ptExtraInfoDlg.ui
|
||||||
|
ui/ctExtraInfoDlg.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
属性组界面基类
|
属性组界面基类
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
|
class BaseProperty;
|
||||||
|
|
||||||
class BaseContentDlg : public QDialog
|
class BaseContentDlg : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
@ -17,8 +19,10 @@ public:
|
||||||
BaseContentDlg(QWidget *parent = nullptr);
|
BaseContentDlg(QWidget *parent = nullptr);
|
||||||
virtual ~BaseContentDlg();
|
virtual ~BaseContentDlg();
|
||||||
virtual void createGroupView(groupStateInfo) = 0; //创建页面
|
virtual void createGroupView(groupStateInfo) = 0; //创建页面
|
||||||
virtual QMap<QString,propertyStateInfo> getPropertyValue() = 0; //返回当前页面的属性值
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr) = 0; //返回当前页面的属性值
|
||||||
virtual void setPropertyValue(QMap<QString,propertyStateInfo>) = 0;
|
//void setPropertyValue(QMap<QString,propertyStateInfo>);
|
||||||
|
//void setPropertyValue(BaseProperty*);
|
||||||
|
virtual void setPropertyValue(QVariant) = 0;
|
||||||
protected:
|
protected:
|
||||||
QMap<QString,propertyContentInfo> _mapPro;
|
QMap<QString,propertyContentInfo> _mapPro;
|
||||||
QFormLayout* createFormLayout(QWidget* parent);
|
QFormLayout* createFormLayout(QWidget* parent);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class baseInfoDlg; }
|
namespace Ui { class baseInfoDlg; }
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class QButtonGroup;
|
||||||
|
|
||||||
class BaseInfoDlg : public BaseContentDlg
|
class BaseInfoDlg : public BaseContentDlg
|
||||||
{
|
{
|
||||||
|
|
@ -17,11 +18,11 @@ public:
|
||||||
~BaseInfoDlg();
|
~BaseInfoDlg();
|
||||||
|
|
||||||
virtual void createGroupView(groupStateInfo);
|
virtual void createGroupView(groupStateInfo);
|
||||||
virtual QMap<QString,propertyStateInfo> getPropertyValue();
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr);
|
||||||
virtual void setPropertyValue(QMap<QString,propertyStateInfo>);
|
virtual void setPropertyValue(QVariant);
|
||||||
private:
|
private:
|
||||||
Ui::baseInfoDlg *ui;
|
Ui::baseInfoDlg *ui;
|
||||||
|
QButtonGroup* _stateGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef CTEXTRAINFODLG_H
|
||||||
|
#define CTEXTRAINFODLG_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "baseContentDlg.h"
|
||||||
|
#include "global.h"
|
||||||
|
/*******************************************************
|
||||||
|
ct扩展信息界面
|
||||||
|
********************************************************/
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class ctExtraInfoDlg; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class BaseProperty;
|
||||||
|
class QButtonGroup;
|
||||||
|
|
||||||
|
class CtExtraInfoDlg : public BaseContentDlg
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CtExtraInfoDlg(QWidget *parent = nullptr);
|
||||||
|
virtual ~CtExtraInfoDlg();
|
||||||
|
virtual void createGroupView(groupStateInfo);
|
||||||
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
||||||
|
virtual void setPropertyValue(QVariant);
|
||||||
|
public slots:
|
||||||
|
void onAddClicked();
|
||||||
|
void onDeleteClicked();
|
||||||
|
protected:
|
||||||
|
void addTableRow(QString,QString,QString,int id = -1);
|
||||||
|
private:
|
||||||
|
Ui::ctExtraInfoDlg *ui;
|
||||||
|
QMap<QString,CtExtraInfo> _mapCT;
|
||||||
|
QButtonGroup* _stateGroup_ct;
|
||||||
|
int _count;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#define ELECTRICSVGITEMBUS_H
|
#define ELECTRICSVGITEMBUS_H
|
||||||
|
|
||||||
#include "electricSvgItem.h"
|
#include "electricSvgItem.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
|
||||||
class ElectricSvgItemBus :public ElectricSvgItem
|
class ElectricSvgItemBus :public ElectricSvgItem
|
||||||
{
|
{
|
||||||
|
|
@ -19,11 +20,4 @@ private:
|
||||||
virtual void updateHandles();
|
virtual void updateHandles();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ElectricSvgItemBus_Property: public BaseProperty
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricSvgItemBus_Property(QObject* parent);
|
|
||||||
~ElectricSvgItemBus_Property();
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#define ELECTRICSVGITEMTRIANGLE_H
|
#define ELECTRICSVGITEMTRIANGLE_H
|
||||||
|
|
||||||
#include "electricSvgItem.h"
|
#include "electricSvgItem.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
|
||||||
class ElectricSvgItemTriangle :public ElectricSvgItem
|
class ElectricSvgItemTriangle :public ElectricSvgItem
|
||||||
{
|
{
|
||||||
|
|
@ -16,12 +17,4 @@ private:
|
||||||
double m_dTopRatioX;
|
double m_dTopRatioX;
|
||||||
double m_dBottomRatioX;
|
double m_dBottomRatioX;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ElectricSvgItemTriangle_Property: public BaseProperty
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ElectricSvgItemTriangle_Property(QObject* parent);
|
|
||||||
~ElectricSvgItemTriangle_Property();
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -514,85 +514,4 @@ protected:
|
||||||
PowerEntity* _pEntity; //图元拓扑
|
PowerEntity* _pEntity; //图元拓扑
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseProperty:public QObject //属性类,存放电路元件属性
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
BaseProperty(QObject* parent);
|
|
||||||
virtual ~BaseProperty();
|
|
||||||
|
|
||||||
void setUuid(QUuid id) {uUid = id;}
|
|
||||||
QUuid uuid() const {return uUid;}
|
|
||||||
void setModelName(QString sName) {sModelName = sName;}
|
|
||||||
QString modelName() const {return sModelName;}
|
|
||||||
void setType(int n) {nType = n;}
|
|
||||||
int type() const {return nType;}
|
|
||||||
void setPage(int n){nPageId = n;}
|
|
||||||
int page() const {return nPageId;}
|
|
||||||
void setTag(QString s){sTag = s;}
|
|
||||||
QString tag() const {return sTag;}
|
|
||||||
void setName(QString s){sName = s;}
|
|
||||||
QString name() const {return sName;}
|
|
||||||
void setPath(QString s){sPath = s;}
|
|
||||||
QString path() const {return sPath;}
|
|
||||||
void setDescription(QString s) {sDescription = s;}
|
|
||||||
QString description() const {return sDescription;}
|
|
||||||
void setInService(bool b) {bInService = b;}
|
|
||||||
bool inService() {return bInService;}
|
|
||||||
void setState(int n) {nState = n;}
|
|
||||||
int state() const {return nState;}
|
|
||||||
void setConnectedBus(QJsonObject j) {jConnectedBus = j;}
|
|
||||||
QJsonObject connectedBus() const {return jConnectedBus;}
|
|
||||||
void setLabel(QJsonObject j){jLabel = j;}
|
|
||||||
QJsonObject label() const {return jLabel;}
|
|
||||||
void setContext(QJsonObject j){jContext = j;}
|
|
||||||
QJsonObject context() const {return jContext;}
|
|
||||||
void setGrid(const QString& s) {sGrid = s;}
|
|
||||||
QString grid() const {return sGrid;}
|
|
||||||
void setZone(const QString& s) {sZone = s;}
|
|
||||||
QString zone() const {return sZone;}
|
|
||||||
void setStation(const QString& s) {sStation = s;}
|
|
||||||
QString station() const {return sStation;}
|
|
||||||
|
|
||||||
void setPrepareDelete(bool b) {_prepareDelete = b;}
|
|
||||||
bool prepareDelete() const {return _prepareDelete;}
|
|
||||||
void setDataChanged(bool b) {_dataChanged = b;} //数据变换标签
|
|
||||||
bool dataChanged() const {return _dataChanged;}
|
|
||||||
void notifyUpdate(){emit updateData();}
|
|
||||||
signals:
|
|
||||||
void updateData(); //通知数据拥有者更新
|
|
||||||
protected:
|
|
||||||
QUuid uUid;
|
|
||||||
QString sModelName; //模型名
|
|
||||||
int nType; //设备类型
|
|
||||||
int nPageId; //暂定为创建本数据的图Id(待定)
|
|
||||||
QString sTag;
|
|
||||||
QString sName;
|
|
||||||
QString sPath;
|
|
||||||
QString sDescription;
|
|
||||||
QString sGrid;
|
|
||||||
QString sZone;
|
|
||||||
QString sStation;
|
|
||||||
bool bInService;
|
|
||||||
int nState;
|
|
||||||
QJsonObject jConnectedBus;
|
|
||||||
QJsonObject jLabel;
|
|
||||||
QJsonObject jContext; //存放port信息
|
|
||||||
|
|
||||||
bool _dataChanged; //数据状态,为真则写入库
|
|
||||||
bool _prepareDelete; //状态,为真准备删除
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef QMap<QString,QVariant> VariableMap; //属性名,值
|
|
||||||
|
|
||||||
class VariableProperty:public BaseProperty //收到的变量数据
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
VariableProperty(QObject* parent);
|
|
||||||
~VariableProperty();
|
|
||||||
|
|
||||||
modelDataInfo getPropertyValue() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,9 @@ public:
|
||||||
~PropertyContentDlg();
|
~PropertyContentDlg();
|
||||||
|
|
||||||
virtual void createGroupView(groupStateInfo); //创建页面
|
virtual void createGroupView(groupStateInfo); //创建页面
|
||||||
virtual QMap<QString,propertyStateInfo> getPropertyValue(); //返回当前页面的属性值
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
||||||
virtual void setPropertyValue(QMap<QString,propertyStateInfo>);
|
//void setPropertyValue(QMap<QString,propertyStateInfo>);
|
||||||
|
virtual void setPropertyValue(QVariant);
|
||||||
protected:
|
protected:
|
||||||
QVBoxLayout* _layout;
|
QVBoxLayout* _layout;
|
||||||
QWidget* createEditor(propertyStateInfo); //创建属性
|
QWidget* createEditor(propertyStateInfo); //创建属性
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef PTEXTRAINFODLG_H
|
||||||
|
#define PTEXTRAINFODLG_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "baseContentDlg.h"
|
||||||
|
#include "global.h"
|
||||||
|
/*******************************************************
|
||||||
|
扩展信息界面
|
||||||
|
********************************************************/
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class ptExtraInfoDlg; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class BaseProperty;
|
||||||
|
class QButtonGroup;
|
||||||
|
|
||||||
|
class PtExtraInfoDlg : public BaseContentDlg
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PtExtraInfoDlg(QWidget *parent = nullptr);
|
||||||
|
virtual ~PtExtraInfoDlg();
|
||||||
|
virtual void createGroupView(groupStateInfo);
|
||||||
|
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
||||||
|
virtual void setPropertyValue(QVariant);
|
||||||
|
public slots:
|
||||||
|
void onAddClicked();
|
||||||
|
void onDeleteClicked();
|
||||||
|
protected:
|
||||||
|
void addTableRow(QString,QString,QString,QString,int id = -1);
|
||||||
|
private:
|
||||||
|
Ui::ptExtraInfoDlg *ui;
|
||||||
|
QMap<QString,PtExtraInfo> _mapPT;
|
||||||
|
QButtonGroup* _stateGroup_pt;
|
||||||
|
int _count;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -47,11 +47,6 @@ public:
|
||||||
PowerEntity* findDiagram(const QString& id) const;
|
PowerEntity* findDiagram(const QString& id) const;
|
||||||
bool deleteDiagram(const QString& id);
|
bool deleteDiagram(const QString& id);
|
||||||
|
|
||||||
//===========================元件实时数据================================
|
|
||||||
void insertEntityData(QUuid,BaseProperty*);
|
|
||||||
BaseProperty* findEntityData(QUuid);
|
|
||||||
void deleteEntityData(QUuid);
|
|
||||||
QMap<QUuid,BaseProperty*> getEntityData() const;
|
|
||||||
public:
|
public:
|
||||||
// 接线点管理
|
// 接线点管理
|
||||||
PowerTerminal* createTerminal(const QString& parentEntityId,
|
PowerTerminal* createTerminal(const QString& parentEntityId,
|
||||||
|
|
@ -81,8 +76,6 @@ private:
|
||||||
// 连接存储
|
// 连接存储
|
||||||
QHash<QString,PowerConnection*> m_connections;
|
QHash<QString,PowerConnection*> m_connections;
|
||||||
QMultiHash<QString,PowerConnection*> m_connectionIndex; // 接线点ID到连接的映射
|
QMultiHash<QString,PowerConnection*> m_connectionIndex; // 接线点ID到连接的映射
|
||||||
|
|
||||||
QMap<QUuid,BaseProperty*> m_entityData; //每个实例化元件的唯一数据
|
|
||||||
private:
|
private:
|
||||||
QHash<QString, PowerTerminal*> m_allTerminals; // ID到接线点映射
|
QHash<QString, PowerTerminal*> m_allTerminals; // ID到接线点映射
|
||||||
QHash<QString, QList<PowerTerminal*>> m_terminalsByEntity; // 实体ID到接线点列表
|
QHash<QString, QList<PowerTerminal*>> m_terminalsByEntity; // 实体ID到接线点列表
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,20 @@
|
||||||
#include "baseInfoDlg.h"
|
#include "baseInfoDlg.h"
|
||||||
|
#include "graphicsItem/graphicsBaseItem.h"
|
||||||
#include "ui_baseInfoDlg.h"
|
#include "ui_baseInfoDlg.h"
|
||||||
|
#include "dataBase.h"
|
||||||
|
#include "global.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
#include "basePropertyManager.h"
|
||||||
|
#include <QButtonGroup>
|
||||||
|
|
||||||
BaseInfoDlg::BaseInfoDlg(QWidget *parent)
|
BaseInfoDlg::BaseInfoDlg(QWidget *parent)
|
||||||
: BaseContentDlg(parent)
|
: BaseContentDlg(parent)
|
||||||
, ui(new Ui::baseInfoDlg)
|
, ui(new Ui::baseInfoDlg)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
//this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
_stateGroup = new QButtonGroup(this);
|
||||||
|
_stateGroup->addButton(ui->rb_inService,1);
|
||||||
|
_stateGroup->addButton(ui->rb_outService,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseInfoDlg::~BaseInfoDlg()
|
BaseInfoDlg::~BaseInfoDlg()
|
||||||
|
|
@ -16,50 +24,87 @@ BaseInfoDlg::~BaseInfoDlg()
|
||||||
|
|
||||||
void BaseInfoDlg::createGroupView(groupStateInfo infos)
|
void BaseInfoDlg::createGroupView(groupStateInfo infos)
|
||||||
{
|
{
|
||||||
|
QList<gridInfo> lstGrid = DataBase::GetInstance()->getAllGrid();
|
||||||
|
QList<zoneInfo> lstZone = DataBase::GetInstance()->getAllZone();
|
||||||
|
QList<stationInfo> lstStation = DataBase::GetInstance()->getAllStation();
|
||||||
|
|
||||||
|
for(auto &info:lstGrid)
|
||||||
|
{
|
||||||
|
ui->cb_grid->addItem(info.name,info.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto &info:lstZone)
|
||||||
|
{
|
||||||
|
ui->cb_zone->addItem(info.name,info.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto &info:lstStation)
|
||||||
|
{
|
||||||
|
ui->cb_station->addItem(info.name,info.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString,propertyStateInfo> BaseInfoDlg::getPropertyValue()
|
QMap<QString,propertyStateInfo> BaseInfoDlg::getPropertyValue(BaseProperty* pPro)
|
||||||
{
|
{
|
||||||
QMap<QString,propertyStateInfo> map;
|
QMap<QString,propertyStateInfo> map;
|
||||||
|
|
||||||
propertyStateInfo uuid;
|
if(pPro)
|
||||||
uuid.type = "UUID";
|
{
|
||||||
uuid.name = "global_uuid";
|
pPro->setTag(ui->le_tag->text());
|
||||||
uuid.defaultValue = ui->le_uuid->text();
|
pPro->setPath(ui->le_nameSpace->text());
|
||||||
map.insert(uuid.name,uuid);
|
pPro->setName(ui->le_name->text());
|
||||||
|
pPro->setLabel(QJsonObject());
|
||||||
|
pPro->setDescription(ui->le_description->text());
|
||||||
|
pPro->setGrid(ui->cb_grid->currentText());
|
||||||
|
pPro->setZone(ui->cb_zone->currentText());
|
||||||
|
pPro->setStation(ui->cb_station->currentText());
|
||||||
|
|
||||||
propertyStateInfo tag;
|
QJsonObject connectBus;
|
||||||
tag.type = "VARCHAR";
|
connectBus["bay_name"] = ui->le_bayName->text();
|
||||||
tag.name = "tag";
|
connectBus["bay_offset_outer"] = ui->le_idx_1->text();
|
||||||
tag.defaultValue = ui->le_tag->text();
|
connectBus["bay_offset_inner"] = ui->le_idx_2->text();
|
||||||
map.insert(tag.name,tag);
|
connectBus["from_uuid"] = ui->le_from->text();
|
||||||
|
connectBus["to_uuid"] = ui->le_to->text();
|
||||||
|
pPro->setConnectedBus(connectBus);
|
||||||
|
pPro->setInService(_stateGroup->checkedId());
|
||||||
|
pPro->setState(ui->le_status->text().toInt());
|
||||||
|
|
||||||
propertyStateInfo nsPath;
|
emit BasePropertyManager::instance().dataChanged(pPro->uuid().toString());
|
||||||
nsPath.type = "VARCHAR";
|
}
|
||||||
nsPath.name = "nspath";
|
|
||||||
nsPath.defaultValue = ui->le_nameSpace->text();
|
|
||||||
map.insert(nsPath.name,nsPath);
|
|
||||||
|
|
||||||
propertyStateInfo pName;
|
|
||||||
pName.type = "VARCHAR";
|
|
||||||
pName.name = "name";
|
|
||||||
pName.defaultValue = ui->le_name->text();
|
|
||||||
map.insert(pName.name,pName);
|
|
||||||
|
|
||||||
propertyStateInfo label;
|
|
||||||
label.type = "JSONB";
|
|
||||||
label.name = "label";
|
|
||||||
label.defaultValue = ui->le_label->text();
|
|
||||||
map.insert(label.name,label);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseInfoDlg::setPropertyValue(QMap<QString,propertyStateInfo> map)
|
void BaseInfoDlg::setPropertyValue(QVariant var)
|
||||||
{
|
{
|
||||||
for(auto &info:map)
|
BaseProperty* pPro = static_cast<BaseProperty*>(var.value<void*>());
|
||||||
|
if(pPro)
|
||||||
{
|
{
|
||||||
propertyContentInfo pro = _mapPro[info.name];
|
ui->le_uuid->setText(pPro->uuid().toString());
|
||||||
|
ui->le_tag->setText(pPro->tag());
|
||||||
|
ui->le_nameSpace->setText(pPro->path());
|
||||||
|
ui->le_name->setText(pPro->name());
|
||||||
|
ui->le_label->setText(""); //label josn格式暂不解析
|
||||||
|
ui->le_description->setText(pPro->description());
|
||||||
|
ui->cb_grid->setCurrentText(pPro->grid());
|
||||||
|
ui->cb_zone->setCurrentText(pPro->zone());
|
||||||
|
ui->cb_station->setCurrentText(pPro->station());
|
||||||
|
|
||||||
|
ui->le_status->setText(QString::number(pPro->state())); //page status字段将移动到component
|
||||||
|
|
||||||
|
QJsonObject connectBus = pPro->connectedBus();
|
||||||
|
QString bay_name = connectBus["bay_name"].toString();
|
||||||
|
QString bay_offset_outer = connectBus["bay_offset_outer"].toString();
|
||||||
|
QString bay_offset_inner = connectBus["bay_offset_inner"].toString();
|
||||||
|
QString from_uuid = connectBus["from_uuid"].toString();
|
||||||
|
QString to_uuid = connectBus["to_uuid"].toString();
|
||||||
|
ui->le_bayName->setText(bay_name);
|
||||||
|
ui->le_idx_1->setText(bay_offset_outer);
|
||||||
|
ui->le_idx_2->setText(bay_offset_inner);
|
||||||
|
ui->le_from->setText(from_uuid);
|
||||||
|
ui->le_to->setText(to_uuid);
|
||||||
|
if(pPro->inService() == 1)
|
||||||
|
ui->rb_inService->setChecked(true);
|
||||||
|
else
|
||||||
|
ui->rb_outService->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,226 @@
|
||||||
|
#include "ctExtraInfoDlg.h"
|
||||||
|
#include "ui_ctExtraInfoDlg.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
#include "basePropertyManager.h"
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
CtExtraInfoDlg::CtExtraInfoDlg(QWidget *parent)
|
||||||
|
: BaseContentDlg(parent)
|
||||||
|
, ui(new Ui::ctExtraInfoDlg)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
_stateGroup_ct = new QButtonGroup(this);
|
||||||
|
_stateGroup_ct->addButton(ui->rb_tpt_ct,1);
|
||||||
|
_stateGroup_ct->addButton(ui->rb_zst_ct,0);
|
||||||
|
|
||||||
|
connect(ui->btn_add_ct,&QPushButton::clicked,this,&CtExtraInfoDlg::onAddClicked);
|
||||||
|
_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CtExtraInfoDlg::~CtExtraInfoDlg()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CtExtraInfoDlg::createGroupView(groupStateInfo infos)
|
||||||
|
{
|
||||||
|
for(auto& info:infos.info) {
|
||||||
|
propertyContentInfo inf;
|
||||||
|
inf.proName = info.name;
|
||||||
|
inf.proType = info.type;
|
||||||
|
_mapPro.insert(info.name,inf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString,propertyStateInfo> CtExtraInfoDlg::getPropertyValue(BaseProperty* pPro)
|
||||||
|
{
|
||||||
|
QMap<QString,propertyStateInfo> map;
|
||||||
|
|
||||||
|
for(auto &pro:_mapPro)
|
||||||
|
{
|
||||||
|
propertyStateInfo info;
|
||||||
|
info.type = pro.proType;
|
||||||
|
info.name = pro.proName;
|
||||||
|
if(info.name == "额定电流") //此处应为类型名
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_ratedCurrent->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "工频耐压")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_pfwv_ct->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "冲击耐压")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_iwv_ct->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "动稳定电流")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_dsc_ct->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "仪表保安系数")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_isf->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "短时热电流")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_sttc->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "额定频率")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_rf_ct->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "相数")
|
||||||
|
{
|
||||||
|
if(ui->rb_tpt_ct->isChecked())
|
||||||
|
info.defaultValue = 1;
|
||||||
|
else
|
||||||
|
info.defaultValue = 0;
|
||||||
|
}
|
||||||
|
else if(info.name == "ct绕组")
|
||||||
|
{
|
||||||
|
QJsonObject object;
|
||||||
|
QJsonArray arr;
|
||||||
|
for(auto info:_mapCT)
|
||||||
|
{
|
||||||
|
QJsonObject obj;
|
||||||
|
obj["id"] = info.id;
|
||||||
|
obj["transformationRatio"] = info.transRatio;
|
||||||
|
obj["accuracyClass"] = info.accuracyClass;
|
||||||
|
obj["secondaryLoadCapacity"] = info.secondaryLoadCapacity;
|
||||||
|
arr.push_back(obj);
|
||||||
|
}
|
||||||
|
object["winding"] = arr;
|
||||||
|
info.defaultValue = object;
|
||||||
|
}
|
||||||
|
map.insert(pro.proName,info);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CtExtraInfoDlg::setPropertyValue(QVariant var)
|
||||||
|
{
|
||||||
|
BaseProperty* pPro = static_cast<BaseProperty*>(var.value<void*>());
|
||||||
|
if(pPro)
|
||||||
|
{
|
||||||
|
QMap<QString,propertyStateInfo> map = var.value<QMap<QString,propertyStateInfo>>();
|
||||||
|
for(auto &info:map)
|
||||||
|
{
|
||||||
|
if(info.name == "额定电流") //此处应为类型名
|
||||||
|
{
|
||||||
|
ui->le_ratedCurrent->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "工频耐压")
|
||||||
|
{
|
||||||
|
ui->le_pfwv_ct->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "冲击耐压")
|
||||||
|
{
|
||||||
|
ui->le_iwv_ct->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "动稳定电流")
|
||||||
|
{
|
||||||
|
ui->le_dsc_ct->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "仪表保安系数")
|
||||||
|
{
|
||||||
|
ui->le_isf->setText(info.defaultValue.toString());
|
||||||
|
}
|
||||||
|
else if(info.name == "短时热电流")
|
||||||
|
{
|
||||||
|
ui->le_sttc->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "额定频率")
|
||||||
|
{
|
||||||
|
ui->le_rf_ct->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "相数")
|
||||||
|
{
|
||||||
|
if(info.defaultValue.toInt() == 1)
|
||||||
|
ui->rb_tpt_ct->setChecked(true);
|
||||||
|
else
|
||||||
|
ui->rb_zst_ct->setChecked(true);
|
||||||
|
}
|
||||||
|
else if(info.name == "ct绕组")
|
||||||
|
{
|
||||||
|
QJsonObject object = info.defaultValue.toJsonObject();
|
||||||
|
QJsonArray arr = object["winding"].toArray();
|
||||||
|
for (QJsonValueRef jsonObj : arr)
|
||||||
|
{
|
||||||
|
QJsonObject node = jsonObj.toObject();
|
||||||
|
int id = node["id"].toInt();
|
||||||
|
QString sTr = node["transformationRatio"].toString();
|
||||||
|
QString sAr = node["accuracyClass"].toString();
|
||||||
|
QString sSlc = node["secondaryLoadCapacity"].toString();
|
||||||
|
|
||||||
|
addTableRow(sTr,sAr,sSlc,id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CtExtraInfoDlg::onAddClicked()
|
||||||
|
{
|
||||||
|
QString sTr = ui->le_tr_ct->text();
|
||||||
|
QString sAr = ui->le_ac_ct->text();
|
||||||
|
QString sSlc = ui->le_slc_ct->text();
|
||||||
|
addTableRow(sTr,sAr,sSlc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CtExtraInfoDlg::onDeleteClicked()
|
||||||
|
{
|
||||||
|
QPushButton *btn = qobject_cast<QPushButton*>(sender());
|
||||||
|
if (btn) {
|
||||||
|
// 获取按钮在表格中的位置
|
||||||
|
QModelIndex index = ui->tb_ct->indexAt(btn->pos());
|
||||||
|
if (index.isValid()) {
|
||||||
|
QTableWidgetItem* pFirstItem = ui->tb_ct->item(index.row(),0);
|
||||||
|
int id = pFirstItem->data(Qt::UserRole).toInt();
|
||||||
|
_mapCT.remove(QString::number(id));
|
||||||
|
ui->tb_ct->removeRow(index.row());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CtExtraInfoDlg::addTableRow(QString sTr,QString sAr,QString sSlc,int id)
|
||||||
|
{
|
||||||
|
if(_mapCT.contains(QString::number(id)))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CtExtraInfo info;
|
||||||
|
if(id == -1){ //缺省id时新建,否则加载
|
||||||
|
info.id = _count;
|
||||||
|
_count += 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
info.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
int row = ui->tb_ct->rowCount();
|
||||||
|
ui->tb_ct->insertRow(row);
|
||||||
|
|
||||||
|
// 变比(输入框)
|
||||||
|
QTableWidgetItem *item = new QTableWidgetItem(sTr);
|
||||||
|
item->setData(Qt::UserRole,info.id);
|
||||||
|
ui->tb_ct->setItem(row, 0, item);
|
||||||
|
|
||||||
|
// 精度等级(下拉框)
|
||||||
|
ui->tb_ct->setItem(row, 1, new QTableWidgetItem(sAr));
|
||||||
|
|
||||||
|
// 二次负载容量(输入框)
|
||||||
|
ui->tb_ct->setItem(row, 2, new QTableWidgetItem(sSlc));
|
||||||
|
|
||||||
|
|
||||||
|
// 删除按钮
|
||||||
|
QPushButton *deleteBtn = new QPushButton("删除");
|
||||||
|
connect(deleteBtn, &QPushButton::clicked, this, &CtExtraInfoDlg::onDeleteClicked);
|
||||||
|
ui->tb_ct->setCellWidget(row, 3, deleteBtn);
|
||||||
|
|
||||||
|
info.transRatio = sTr;
|
||||||
|
info.accuracyClass = sAr;
|
||||||
|
info.secondaryLoadCapacity = sSlc;
|
||||||
|
_mapCT.insert(QString::number(info.id),info);
|
||||||
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ void DiagramCavas::onSignal_savePage()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DataBase::GetInstance()->getPageIdByName(_curPage) == -1) //不存在,创建
|
if(DataBase::GetInstance()->getPageIdByName(_curPage) == -1) //不存在,创建
|
||||||
DataBase::GetInstance()->insertPage(_curPage,_curPage,1,QJsonObject(),pPanel->getDiagramInfo(),QString("page"),1);
|
DataBase::GetInstance()->insertPage(_curPage,_curPage,QJsonObject(),pPanel->getDiagramInfo(),QString("page"),1);
|
||||||
else
|
else
|
||||||
DataBase::GetInstance()->updatePage(_curPage,_curPage,pPanel->getDiagramInfo());
|
DataBase::GetInstance()->updatePage(_curPage,_curPage,pPanel->getDiagramInfo());
|
||||||
int pageId = DataBase::GetInstance()->getPageIdByName(_curPage);
|
int pageId = DataBase::GetInstance()->getPageIdByName(_curPage);
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ void DrawingPanel::closeEvent(QCloseEvent *closeEvent)
|
||||||
pItem->updateConnectData();
|
pItem->updateConnectData();
|
||||||
}
|
}
|
||||||
if(DataBase::GetInstance()->getPageIdByName(_name) == -1) //不存在,创建
|
if(DataBase::GetInstance()->getPageIdByName(_name) == -1) //不存在,创建
|
||||||
DataBase::GetInstance()->insertPage(_name,_name,1,QJsonObject(),getDiagramInfo(),QString("page"),1);
|
DataBase::GetInstance()->insertPage(_name,_name,QJsonObject(),getDiagramInfo(),QString("page"),1);
|
||||||
else
|
else
|
||||||
DataBase::GetInstance()->updatePage(_name,_name,getDiagramInfo());
|
DataBase::GetInstance()->updatePage(_name,_name,getDiagramInfo());
|
||||||
int pageId = DataBase::GetInstance()->getPageIdByName(_name);
|
int pageId = DataBase::GetInstance()->getPageIdByName(_name);
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,10 @@
|
||||||
#include "dataManager.h"
|
#include "dataManager.h"
|
||||||
#include "powerEntity.h"
|
#include "powerEntity.h"
|
||||||
#include "topologyManager.h"
|
#include "topologyManager.h"
|
||||||
|
#include "basePropertyManager.h"
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include "baseProperty.h"
|
||||||
|
|
||||||
bool FixedPortsModel::_dataInitialised = false;
|
bool FixedPortsModel::_dataInitialised = false;
|
||||||
|
|
||||||
|
|
@ -91,7 +93,7 @@ void FixedPortsModel::addNodeItem(QUuid id/*,int type*/,QPointF pos)
|
||||||
//todo:load图形时必有拓扑实体,关联到对应的entity
|
//todo:load图形时必有拓扑实体,关联到对应的entity
|
||||||
BaseProperty* pro = nullptr;
|
BaseProperty* pro = nullptr;
|
||||||
GraphicsBaseItem* item = nullptr;
|
GraphicsBaseItem* item = nullptr;
|
||||||
QMap<QUuid,BaseProperty*> mapData = TopologyManager::instance().getEntityData(); //加载的图形必定关联component(todo:完善判断条件,如判断拓扑节点)
|
QMap<QUuid,BaseProperty*> mapData = BasePropertyManager::instance().getEntityData(); //加载的图形必定关联component(todo:完善判断条件,如判断拓扑节点)
|
||||||
if(mapData.contains(id))
|
if(mapData.contains(id))
|
||||||
{
|
{
|
||||||
pro = mapData[id];
|
pro = mapData[id];
|
||||||
|
|
@ -154,7 +156,7 @@ void FixedPortsModel::addNodeItem(QUuid id/*,int type*/,QPointF pos)
|
||||||
|
|
||||||
BaseProperty* FixedPortsModel::addNodeData(QUuid id,int type,QString name,QString modelName)
|
BaseProperty* FixedPortsModel::addNodeData(QUuid id,int type,QString name,QString modelName)
|
||||||
{
|
{
|
||||||
BaseProperty* pData = TopologyManager::instance().findEntityData(id); //已存在不不创建
|
BaseProperty* pData = BasePropertyManager::instance().findEntityData(id); //已存在不不创建
|
||||||
if(pData != nullptr)
|
if(pData != nullptr)
|
||||||
return pData;
|
return pData;
|
||||||
|
|
||||||
|
|
@ -168,7 +170,7 @@ BaseProperty* FixedPortsModel::addNodeData(QUuid id,int type,QString name,QStrin
|
||||||
item->setType(type);
|
item->setType(type);
|
||||||
item->setTag(name);
|
item->setTag(name);
|
||||||
item->setName(name);
|
item->setName(name);
|
||||||
TopologyManager::instance().insertEntityData(id,item);
|
BasePropertyManager::instance().insertEntityData(id,item);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +183,6 @@ void FixedPortsModel::loadNodeDataFromDataBase()
|
||||||
for(auto &info:lst)
|
for(auto &info:lst)
|
||||||
{
|
{
|
||||||
BaseProperty* pData = addNodeData(info.uuid,info.type,info.name,info.modelName);
|
BaseProperty* pData = addNodeData(info.uuid,info.type,info.name,info.modelName);
|
||||||
pData->setPage(info.page_id);
|
|
||||||
pData->setTag(info.tag);
|
pData->setTag(info.tag);
|
||||||
pData->setName(info.name);
|
pData->setName(info.name);
|
||||||
pData->setPath(info.nspath);
|
pData->setPath(info.nspath);
|
||||||
|
|
@ -205,7 +206,7 @@ void FixedPortsModel::loadNodeDataFromDataBase()
|
||||||
QList<topologicInfo> lstTopo = DataBase::GetInstance()->getAllTopologics();
|
QList<topologicInfo> lstTopo = DataBase::GetInstance()->getAllTopologics();
|
||||||
for(auto &info:lstTopo)
|
for(auto &info:lstTopo)
|
||||||
{
|
{
|
||||||
TopologyManager::instance().createConnection(QString::number(info.id),info.pin_from.toString(),info.pin_to.toString(),info.uuid_from.toString(),info.uuid_to.toString());
|
TopologyManager::instance().createConnection(QString::number(info.id),info.from_pin.toString(),info.to_pin.toString(),info.uuid_from.toString(),info.uuid_to.toString());
|
||||||
}
|
}
|
||||||
_dataInitialised = true;
|
_dataInitialised = true;
|
||||||
}
|
}
|
||||||
|
|
@ -455,7 +456,7 @@ QVariant FixedPortsModel::nodeData(QUuid nodeId, NodeRole role) const
|
||||||
|
|
||||||
void FixedPortsModel::saveNode(int nPageId)
|
void FixedPortsModel::saveNode(int nPageId)
|
||||||
{
|
{
|
||||||
QMap<QUuid,BaseProperty*> mapData = TopologyManager::instance().getEntityData();
|
QMap<QUuid,BaseProperty*> mapData = BasePropertyManager::instance().getEntityData();
|
||||||
for(auto &pData:mapData)
|
for(auto &pData:mapData)
|
||||||
{
|
{
|
||||||
if(pData->prepareDelete())
|
if(pData->prepareDelete())
|
||||||
|
|
@ -480,7 +481,7 @@ void FixedPortsModel::saveNode(int nPageId)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DataBase::GetInstance()->insertComponent(pData->uuid(),pData->modelName(),pData->path(),pData->tag(),pData->name(),pData->description(),pData->grid(),pData->zone(),pData->station(),pData->type(),true,pData->state(),pData->connectedBus(),pData->label(),pData->context(),nPageId,1);
|
DataBase::GetInstance()->insertComponent(pData->uuid(),pData->modelName(),pData->path(),pData->tag(),pData->name(),pData->description(),pData->grid(),pData->zone(),pData->station(),pData->type(),true,pData->state(),pData->status(),pData->connectedBus(),pData->label(),pData->context(),1);
|
||||||
for(auto &val:dataInfo.groupInfo)
|
for(auto &val:dataInfo.groupInfo)
|
||||||
{
|
{
|
||||||
DataBase::GetInstance()->insertDynamicProperty(pData->uuid(),val);
|
DataBase::GetInstance()->insertDynamicProperty(pData->uuid(),val);
|
||||||
|
|
@ -508,7 +509,7 @@ void FixedPortsModel::saveNode(int nPageId)
|
||||||
TopologyManager::instance().removeConnection(pCon->id());
|
TopologyManager::instance().removeConnection(pCon->id());
|
||||||
break;
|
break;
|
||||||
case DataState::changed:
|
case DataState::changed:
|
||||||
DataBase::GetInstance()->insertTopologic(nPageId,con.nSrcNodeId,con.nDestNodeId,con.nSrcPortId,con.nDestPortId,0,"",0);
|
DataBase::GetInstance()->insertTopologic(con.nSrcNodeId,con.nDestNodeId,con.nSrcPortId,con.nDestPortId,0,"",0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -521,7 +522,7 @@ void FixedPortsModel::onSignal_ifExits(QUuid id,const QString& str,int type,Grap
|
||||||
{
|
{
|
||||||
bool exist = false;
|
bool exist = false;
|
||||||
BaseProperty* pData = nullptr;
|
BaseProperty* pData = nullptr;
|
||||||
QMap<QUuid,BaseProperty*> mapData = TopologyManager::instance().getEntityData();
|
QMap<QUuid,BaseProperty*> mapData = BasePropertyManager::instance().getEntityData();
|
||||||
for(auto pro:mapData)
|
for(auto pro:mapData)
|
||||||
{
|
{
|
||||||
if(pro->tag() == str)
|
if(pro->tag() == str)
|
||||||
|
|
|
||||||
|
|
@ -58,16 +58,3 @@ void ElectricSvgItemBus::paint(QPainter* painter, const QStyleOptionGraphicsItem
|
||||||
{
|
{
|
||||||
ElectricSvgItem::paint(painter,option,widget);
|
ElectricSvgItem::paint(painter,option,widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
|
|
||||||
ElectricSvgItemBus_Property::ElectricSvgItemBus_Property(QObject* parent)
|
|
||||||
:BaseProperty(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ElectricSvgItemBus_Property::~ElectricSvgItemBus_Property()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -76,15 +76,3 @@ void ElectricSvgItemTriangle::paint(QPainter* painter, const QStyleOptionGraphic
|
||||||
ElectricSvgItem::paint(painter,option,widget);
|
ElectricSvgItem::paint(painter,option,widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
ElectricSvgItemTriangle_Property::ElectricSvgItemTriangle_Property(QObject* parent)
|
|
||||||
:BaseProperty(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ElectricSvgItemTriangle_Property::~ElectricSvgItemTriangle_Property()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "graphicsItem/handleText.h"
|
#include "graphicsItem/handleText.h"
|
||||||
#include "graphicsItem/itemPort.h"
|
#include "graphicsItem/itemPort.h"
|
||||||
#include "graphicsItem/electricConnectLineItem.h"
|
#include "graphicsItem/electricConnectLineItem.h"
|
||||||
#include "dataManager.h"
|
#include "baseProperty.h"
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
|
@ -334,44 +334,3 @@ void GraphicsBaseItem::onUpdateData()
|
||||||
{
|
{
|
||||||
updateByProperty();
|
updateByProperty();
|
||||||
}
|
}
|
||||||
/****************************属性****************************/
|
|
||||||
|
|
||||||
BaseProperty::BaseProperty(QObject* parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
nType = 0; //设备类型
|
|
||||||
nPageId = 0; //暂定为创建本数据的图Id(待定)
|
|
||||||
bInService = true;
|
|
||||||
nState = 1;
|
|
||||||
|
|
||||||
_dataChanged = false;
|
|
||||||
_prepareDelete = false;
|
|
||||||
|
|
||||||
sGrid=QString("1"); //暂时修改,数据库字段不为空
|
|
||||||
sZone=QString("1");
|
|
||||||
sStation=QString("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseProperty::~BaseProperty()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************属性变量*************************/
|
|
||||||
|
|
||||||
VariableProperty::VariableProperty(QObject* parent)
|
|
||||||
:BaseProperty(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
VariableProperty::~VariableProperty()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
modelDataInfo VariableProperty::getPropertyValue() const
|
|
||||||
{
|
|
||||||
ModelDataMap mapData = DataManager::instance().modelData();
|
|
||||||
return mapData[sModelName];
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
#include "ui_itemPropertyDlg.h"
|
#include "ui_itemPropertyDlg.h"
|
||||||
#include "baseContentDlg.h"
|
#include "baseContentDlg.h"
|
||||||
#include "baseInfoDlg.h"
|
#include "baseInfoDlg.h"
|
||||||
|
//#include "topologyManager.h"
|
||||||
|
#include "basePropertyManager.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
#include "ptExtraInfoDlg.h"
|
||||||
|
#include "ctExtraInfoDlg.h"
|
||||||
|
|
||||||
ItemPropertyDlg::ItemPropertyDlg(QWidget *parent)
|
ItemPropertyDlg::ItemPropertyDlg(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
|
|
@ -71,11 +76,13 @@ void ItemPropertyDlg::onOkClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QMap<QString, QWidget*>::Iterator iter;
|
QMap<QString, QWidget*>::Iterator iter;
|
||||||
|
BaseProperty* pPro = BasePropertyManager::instance().findEntityData(curUuid_);
|
||||||
for(iter = groupViews_.begin();iter != groupViews_.end();++iter)
|
for(iter = groupViews_.begin();iter != groupViews_.end();++iter)
|
||||||
{
|
{
|
||||||
PropertyContentDlg* pDlg = qobject_cast<PropertyContentDlg*>(iter.value());
|
BaseContentDlg* pDlg = qobject_cast<BaseContentDlg*>(iter.value());
|
||||||
QMap<QString,propertyStateInfo> mapPro = pDlg->getPropertyValue();
|
QMap<QString,propertyStateInfo> mapPro = pDlg->getPropertyValue(pPro);
|
||||||
DataManager::instance().updateModelData(_curModel,curUuid_,iter.key(),mapPro);
|
if(!mapPro.empty())
|
||||||
|
DataManager::instance().updateModelData(_curModel,curUuid_,iter.key(),mapPro);
|
||||||
}
|
}
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
@ -95,11 +102,18 @@ void ItemPropertyDlg::onGroupSelected(const QString& str)
|
||||||
if(pDlg)
|
if(pDlg)
|
||||||
{
|
{
|
||||||
QMap<QString,propertyStateInfo> valueMap;
|
QMap<QString,propertyStateInfo> valueMap;
|
||||||
if(groupValue_[str].mapInfo.contains(curUuid_))
|
BaseProperty* pPro = BasePropertyManager::instance().findEntityData(curUuid_);
|
||||||
valueMap = groupValue_[str].mapInfo[curUuid_];
|
if(str != QString("component") && str != QString("基本信息"))
|
||||||
else //没有值时使用默认值
|
{
|
||||||
valueMap = groupInfo_[str].info;
|
if(groupValue_[str].mapInfo.contains(curUuid_))
|
||||||
pDlg->setPropertyValue(valueMap);
|
valueMap = groupValue_[str].mapInfo[curUuid_];
|
||||||
|
else //没有值时使用默认值
|
||||||
|
valueMap = groupInfo_[str].info;
|
||||||
|
pDlg->setPropertyValue(QVariant::fromValue(valueMap));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pDlg->setPropertyValue(QVariant::fromValue(static_cast<void*>(pPro)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->stackedWidget->setCurrentWidget(groupViews_[str]);
|
ui->stackedWidget->setCurrentWidget(groupViews_[str]);
|
||||||
|
|
@ -110,10 +124,15 @@ void ItemPropertyDlg::createGroupView(const QString& str)
|
||||||
{
|
{
|
||||||
//todo:基础信息、间隔信息、动态界面在此分支
|
//todo:基础信息、间隔信息、动态界面在此分支
|
||||||
BaseContentDlg* contentDlg = nullptr;
|
BaseContentDlg* contentDlg = nullptr;
|
||||||
|
BaseProperty* pPro = BasePropertyManager::instance().findEntityData(curUuid_);
|
||||||
if(str == QString("component") || str == QString::fromWCharArray(L"基本信息")){
|
if(str == QString("component") || str == QString::fromWCharArray(L"基本信息")){
|
||||||
contentDlg = new BaseInfoDlg(ui->stackedWidget);
|
contentDlg = new BaseInfoDlg(ui->stackedWidget);
|
||||||
}
|
}
|
||||||
else if(str == "bayInfo" || str == QString::fromWCharArray(L"间隔信息")){
|
else if(str == "base_extend" || str == QString::fromWCharArray(L"扩展信息")){
|
||||||
|
//if(pPro->type() == pt)
|
||||||
|
contentDlg = new CtExtraInfoDlg(ui->stackedWidget);
|
||||||
|
}
|
||||||
|
else if(str == "bay" || str == QString::fromWCharArray(L"间隔信息")){
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ QWidget* PropertyContentDlg::createEditor(propertyStateInfo pro)
|
||||||
return pWidget;
|
return pWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString,propertyStateInfo> PropertyContentDlg::getPropertyValue()
|
QMap<QString,propertyStateInfo> PropertyContentDlg::getPropertyValue(BaseProperty* pPro)
|
||||||
{
|
{
|
||||||
QMap<QString,propertyStateInfo> map;
|
QMap<QString,propertyStateInfo> map;
|
||||||
|
|
||||||
|
|
@ -243,8 +243,9 @@ QMap<QString,propertyStateInfo> PropertyContentDlg::getPropertyValue()
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyContentDlg::setPropertyValue(QMap<QString,propertyStateInfo> map)
|
void PropertyContentDlg::setPropertyValue(QVariant var)
|
||||||
{
|
{
|
||||||
|
QMap<QString,propertyStateInfo> map = var.value<QMap<QString,propertyStateInfo>>();
|
||||||
for(auto &info:map)
|
for(auto &info:map)
|
||||||
{
|
{
|
||||||
propertyContentInfo pro = _mapPro[info.name];
|
propertyContentInfo pro = _mapPro[info.name];
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,220 @@
|
||||||
|
#include "ptExtraInfoDlg.h"
|
||||||
|
#include "ui_ptExtraInfoDlg.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
#include "basePropertyManager.h"
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
PtExtraInfoDlg::PtExtraInfoDlg(QWidget *parent)
|
||||||
|
: BaseContentDlg(parent)
|
||||||
|
, ui(new Ui::ptExtraInfoDlg)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
_stateGroup_pt = new QButtonGroup(this);
|
||||||
|
_stateGroup_pt->addButton(ui->rb_tpt_pt,1);
|
||||||
|
_stateGroup_pt->addButton(ui->rb_spt_pt,0);
|
||||||
|
|
||||||
|
connect(ui->btn_add_pt,&QPushButton::clicked,this,&PtExtraInfoDlg::onAddClicked);
|
||||||
|
_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PtExtraInfoDlg::~PtExtraInfoDlg()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtExtraInfoDlg::createGroupView(groupStateInfo infos)
|
||||||
|
{
|
||||||
|
for(auto& info:infos.info) {
|
||||||
|
propertyContentInfo inf;
|
||||||
|
inf.proName = info.name;
|
||||||
|
inf.proType = info.type;
|
||||||
|
_mapPro.insert(info.name,inf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString,propertyStateInfo> PtExtraInfoDlg::getPropertyValue(BaseProperty* pPro)
|
||||||
|
{
|
||||||
|
QMap<QString,propertyStateInfo> map;
|
||||||
|
|
||||||
|
for(auto &pro:_mapPro)
|
||||||
|
{
|
||||||
|
propertyStateInfo info;
|
||||||
|
info.type = pro.proType;
|
||||||
|
info.name = pro.proName;
|
||||||
|
if(info.name == "额定电压") //此处应为类型名
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_ratedVol->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "工频耐压")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_pfwv_pt->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "冲击耐压")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_iwv_pt->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "额定电压因数")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_ratedVolFactor->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "一次绕组接线接地方式")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_pwwgm->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "额定频率")
|
||||||
|
{
|
||||||
|
info.defaultValue = ui->le_rf_pt->text();
|
||||||
|
}
|
||||||
|
else if(info.name == "相数")
|
||||||
|
{
|
||||||
|
if(ui->rb_tpt_pt->isChecked())
|
||||||
|
info.defaultValue = 1;
|
||||||
|
else
|
||||||
|
info.defaultValue = 0;
|
||||||
|
}
|
||||||
|
else if(info.name == "pt绕组")
|
||||||
|
{
|
||||||
|
QJsonObject object;
|
||||||
|
QJsonArray arr;
|
||||||
|
for(auto info:_mapPT)
|
||||||
|
{
|
||||||
|
QJsonObject obj;
|
||||||
|
obj["id"] = info.id;
|
||||||
|
obj["transformationRatio"] = info.transRatio;
|
||||||
|
obj["accuracyClass"] = info.accuracyClass;
|
||||||
|
obj["secondaryLoadCapacity"] = info.secondaryLoadCapacity;
|
||||||
|
obj["windingConnectionMethod"] = info.windingConnectionMethod;
|
||||||
|
arr.push_back(obj);
|
||||||
|
}
|
||||||
|
object["winding"] = arr;
|
||||||
|
info.defaultValue = object;
|
||||||
|
}
|
||||||
|
map.insert(pro.proName,info);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtExtraInfoDlg::setPropertyValue(QVariant var)
|
||||||
|
{
|
||||||
|
QMap<QString,propertyStateInfo> map = var.value<QMap<QString,propertyStateInfo>>();
|
||||||
|
for(auto &info:map)
|
||||||
|
{
|
||||||
|
if(info.name == "额定电压") //此处应为类型名
|
||||||
|
{
|
||||||
|
ui->le_ratedVol->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "工频耐压")
|
||||||
|
{
|
||||||
|
ui->le_pfwv_pt->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "冲击耐压")
|
||||||
|
{
|
||||||
|
ui->le_iwv_pt->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "额定电压因数")
|
||||||
|
{
|
||||||
|
ui->le_ratedVolFactor->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "一次绕组接线接地方式")
|
||||||
|
{
|
||||||
|
ui->le_pwwgm->setText(info.defaultValue.toString());
|
||||||
|
}
|
||||||
|
else if(info.name == "额定频率")
|
||||||
|
{
|
||||||
|
ui->le_rf_pt->setText(QString::number(info.defaultValue.toDouble()));
|
||||||
|
}
|
||||||
|
else if(info.name == "相数")
|
||||||
|
{
|
||||||
|
if(info.defaultValue.toInt() == 1)
|
||||||
|
ui->rb_tpt_pt->setChecked(true);
|
||||||
|
else
|
||||||
|
ui->rb_spt_pt->setChecked(true);
|
||||||
|
}
|
||||||
|
else if(info.name == "pt绕组")
|
||||||
|
{
|
||||||
|
QJsonObject object = info.defaultValue.toJsonObject();
|
||||||
|
QJsonArray arr = object["winding"].toArray();
|
||||||
|
for (QJsonValueRef jsonObj : arr)
|
||||||
|
{
|
||||||
|
QJsonObject node = jsonObj.toObject();
|
||||||
|
int id = node["id"].toInt();
|
||||||
|
QString sTr = node["transformationRatio"].toString();
|
||||||
|
QString sAr = node["accuracyClass"].toString();
|
||||||
|
QString sSlc = node["secondaryLoadCapacity"].toString();
|
||||||
|
QString sWin = node["windingConnectionMethod"].toString();
|
||||||
|
|
||||||
|
addTableRow(sTr,sAr,sSlc,sWin,id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtExtraInfoDlg::onAddClicked()
|
||||||
|
{
|
||||||
|
QString sTr = ui->le_tr_pt->text();
|
||||||
|
QString sAr = ui->le_ac_pt->text();
|
||||||
|
QString sSlc = ui->le_slc_pt->text();
|
||||||
|
QString sWinding = ui->cb_wcm->currentText();
|
||||||
|
addTableRow(sTr,sAr,sSlc,sWinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtExtraInfoDlg::onDeleteClicked()
|
||||||
|
{
|
||||||
|
QPushButton *btn = qobject_cast<QPushButton*>(sender());
|
||||||
|
if (btn) {
|
||||||
|
// 获取按钮在表格中的位置
|
||||||
|
QModelIndex index = ui->tb_pt->indexAt(btn->pos());
|
||||||
|
if (index.isValid()) {
|
||||||
|
QTableWidgetItem* pFirstItem = ui->tb_pt->item(index.row(),0);
|
||||||
|
int id = pFirstItem->data(Qt::UserRole).toInt();
|
||||||
|
_mapPT.remove(QString::number(id));
|
||||||
|
ui->tb_pt->removeRow(index.row());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtExtraInfoDlg::addTableRow(QString sTr,QString sAr,QString sSlc,QString sWinding,int id)
|
||||||
|
{
|
||||||
|
if(_mapPT.contains(QString::number(id)))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PtExtraInfo info;
|
||||||
|
if(id == -1){ //缺省id时新建,否则加载
|
||||||
|
info.id = _count;
|
||||||
|
_count += 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
info.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
int row = ui->tb_pt->rowCount();
|
||||||
|
ui->tb_pt->insertRow(row);
|
||||||
|
|
||||||
|
// 变比(输入框)
|
||||||
|
QTableWidgetItem *item = new QTableWidgetItem(sTr);
|
||||||
|
item->setData(Qt::UserRole,info.id);
|
||||||
|
ui->tb_pt->setItem(row, 0, item);
|
||||||
|
|
||||||
|
// 精度等级(下拉框)
|
||||||
|
ui->tb_pt->setItem(row, 1, new QTableWidgetItem(sAr));
|
||||||
|
|
||||||
|
// 二次负载容量(输入框)
|
||||||
|
ui->tb_pt->setItem(row, 2, new QTableWidgetItem(sSlc));
|
||||||
|
|
||||||
|
// 绕组接法(下拉框)
|
||||||
|
ui->tb_pt->setItem(row, 3, new QTableWidgetItem(sWinding));
|
||||||
|
|
||||||
|
// 删除按钮
|
||||||
|
QPushButton *deleteBtn = new QPushButton("删除");
|
||||||
|
connect(deleteBtn, &QPushButton::clicked, this, &PtExtraInfoDlg::onDeleteClicked);
|
||||||
|
ui->tb_pt->setCellWidget(row, 4, deleteBtn);
|
||||||
|
|
||||||
|
info.transRatio = sTr;
|
||||||
|
info.accuracyClass = sAr;
|
||||||
|
info.secondaryLoadCapacity = sSlc;
|
||||||
|
info.windingConnectionMethod = sWinding;
|
||||||
|
_mapPT.insert(QString::number(info.id),info);
|
||||||
|
}
|
||||||
|
|
@ -29,8 +29,6 @@ void TopologyManager::clearAllData()
|
||||||
m_entities.clear();
|
m_entities.clear();
|
||||||
|
|
||||||
m_allTerminals.clear(); //端点由父亲entity释放
|
m_allTerminals.clear(); //端点由父亲entity释放
|
||||||
|
|
||||||
m_entityData.clear(); //data数据由系统自动释放
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerEntity* TopologyManager::createEntity(EntityType type,const QString& uuid, const QString& name)
|
PowerEntity* TopologyManager::createEntity(EntityType type,const QString& uuid, const QString& name)
|
||||||
|
|
@ -378,29 +376,6 @@ bool TopologyManager::deleteDiagram(const QString& id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopologyManager::insertEntityData(QUuid uid,BaseProperty* p)
|
|
||||||
{
|
|
||||||
if(!m_entityData.contains(uid))
|
|
||||||
m_entityData.insert(uid,p);
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseProperty* TopologyManager::findEntityData(QUuid uid)
|
|
||||||
{
|
|
||||||
return m_entityData.value(uid,nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TopologyManager::deleteEntityData(QUuid uid)
|
|
||||||
{
|
|
||||||
BaseProperty* pData = m_entityData.value(uid,nullptr);
|
|
||||||
if(pData)
|
|
||||||
delete pData;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMap<QUuid,BaseProperty*> TopologyManager::getEntityData() const
|
|
||||||
{
|
|
||||||
return m_entityData;
|
|
||||||
}
|
|
||||||
|
|
||||||
PowerTerminal* TopologyManager::createTerminal(const QString& parentEntityId,
|
PowerTerminal* TopologyManager::createTerminal(const QString& parentEntityId,
|
||||||
TerminalType type,
|
TerminalType type,
|
||||||
const QString& name,
|
const QString& name,
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ border-radius:5px;</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1" colspan="6">
|
<item row="6" column="1" colspan="6">
|
||||||
<widget class="QLineEdit" name="le_nameSpace_2">
|
<widget class="QLineEdit" name="le_bayName">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -298,7 +298,7 @@ border-radius:5px;</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="8" colspan="3">
|
<item row="8" column="8" colspan="3">
|
||||||
<widget class="QLineEdit" name="le_to_2">
|
<widget class="QLineEdit" name="le_status">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,355 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ctExtraInfoDlg</class>
|
||||||
|
<widget class="QWidget" name="ctExtraInfoDlg">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>764</width>
|
||||||
|
<height>597</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" colspan="17">
|
||||||
|
<widget class="QLabel" name="label_title_ct">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">border:4px double dark;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="text">
|
||||||
|
<string>额定电流</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="4">
|
||||||
|
<widget class="QLineEdit" name="le_ratedCurrent">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="text">
|
||||||
|
<string>A</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="7" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_22">
|
||||||
|
<property name="text">
|
||||||
|
<string>动稳定电流</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="9" colspan="4">
|
||||||
|
<widget class="QLineEdit" name="le_dsc_ct">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="13">
|
||||||
|
<widget class="QLabel" name="label_21">
|
||||||
|
<property name="text">
|
||||||
|
<string>A</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="14">
|
||||||
|
<widget class="QLabel" name="label_27">
|
||||||
|
<property name="text">
|
||||||
|
<string>短时热电流</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="15">
|
||||||
|
<widget class="QLineEdit" name="le_sttc">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="16">
|
||||||
|
<widget class="QLabel" name="label_26">
|
||||||
|
<property name="text">
|
||||||
|
<string>As</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_20">
|
||||||
|
<property name="text">
|
||||||
|
<string>工频耐压</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_pfwv_ct">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4" colspan="3">
|
||||||
|
<widget class="QLabel" name="label_19">
|
||||||
|
<property name="text">
|
||||||
|
<string>V/1min</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="7">
|
||||||
|
<widget class="QLabel" name="label_24">
|
||||||
|
<property name="text">
|
||||||
|
<string>冲击耐压</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="8" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_iwv_ct">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="10">
|
||||||
|
<widget class="QLabel" name="label_23">
|
||||||
|
<property name="text">
|
||||||
|
<string>V</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="11">
|
||||||
|
<widget class="QLabel" name="label_25">
|
||||||
|
<property name="text">
|
||||||
|
<string>仪表保安系数</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="12" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_isf">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="14">
|
||||||
|
<widget class="QLabel" name="label_28">
|
||||||
|
<property name="text">
|
||||||
|
<string>额定频率</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="15">
|
||||||
|
<widget class="QLineEdit" name="le_rf_ct">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="16">
|
||||||
|
<widget class="QLabel" name="label_29">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hz</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_30">
|
||||||
|
<property name="text">
|
||||||
|
<string>相数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="2">
|
||||||
|
<widget class="QRadioButton" name="rb_tpt_ct">
|
||||||
|
<property name="text">
|
||||||
|
<string>三相互感器</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3" colspan="4">
|
||||||
|
<widget class="QRadioButton" name="rb_zst_ct">
|
||||||
|
<property name="text">
|
||||||
|
<string>零序互感器</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="3">
|
||||||
|
<widget class="QLabel" name="label_31">
|
||||||
|
<property name="text">
|
||||||
|
<string>本元件内含CT的配置:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_32">
|
||||||
|
<property name="text">
|
||||||
|
<string>变比</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" colspan="4">
|
||||||
|
<widget class="QLineEdit" name="le_tr_ct">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="5" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_34">
|
||||||
|
<property name="text">
|
||||||
|
<string>精度等级</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="7" colspan="4">
|
||||||
|
<widget class="QLineEdit" name="le_ac_ct">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="11">
|
||||||
|
<widget class="QLabel" name="label_33">
|
||||||
|
<property name="text">
|
||||||
|
<string>二次负载容量</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="12" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="le_slc_ct">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="16">
|
||||||
|
<widget class="QPushButton" name="btn_add_ct">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>23</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>23</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>+</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0" colspan="17">
|
||||||
|
<widget class="QTableWidget" name="tb_ct">
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||||
|
<number>180</number>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>变比</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>精度等级</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>二次负载容量</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>删除</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -0,0 +1,344 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ptExtraInfoDlg</class>
|
||||||
|
<widget class="QWidget" name="ptExtraInfoDlg">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>728</width>
|
||||||
|
<height>564</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" colspan="14">
|
||||||
|
<widget class="QLabel" name="label_title_pt">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">border:4px double dark;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>额定电压</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="le_ratedVol">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>V</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>工频耐压</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="7" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_pfwv_pt">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="9">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>V/1min</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="10">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>冲击耐压</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="11" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_iwv_pt">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="13">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>V</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>额定电压因数</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="le_ratedVolFactor">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="6">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>一次绕组接线接地方式</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="7" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="le_pwwgm">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="10">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>额定频率</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="11" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_rf_pt">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="13">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hz</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>相数</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="2">
|
||||||
|
<widget class="QRadioButton" name="rb_tpt_pt">
|
||||||
|
<property name="text">
|
||||||
|
<string>三相互感器</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3" colspan="2">
|
||||||
|
<widget class="QRadioButton" name="rb_spt_pt">
|
||||||
|
<property name="text">
|
||||||
|
<string>单相互感器</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="4">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>本元件内含PT二次绕组的配置:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>变比</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="le_tr_pt">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="4" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_14">
|
||||||
|
<property name="text">
|
||||||
|
<string>精度等级</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="6">
|
||||||
|
<widget class="QLineEdit" name="le_ac_pt">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="7">
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="text">
|
||||||
|
<string>二次负载容量</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="8" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_slc_pt">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="10">
|
||||||
|
<widget class="QLabel" name="label_16">
|
||||||
|
<property name="text">
|
||||||
|
<string>绕组接法</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="11">
|
||||||
|
<widget class="QComboBox" name="cb_wcm">
|
||||||
|
<property name="currentText">
|
||||||
|
<string>Y</string>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Y</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Δ</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="12" colspan="2">
|
||||||
|
<widget class="QPushButton" name="btn_add_pt">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>23</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>23</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>+</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0" colspan="14">
|
||||||
|
<widget class="QTableWidget" name="tb_pt">
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||||
|
<number>130</number>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>变比</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>精度等级</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>二次负载容量</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>绕组接法</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>删除</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -4,7 +4,9 @@ set(DIAGRAMUTILS_HEADER_FILES
|
||||||
include/logger.h
|
include/logger.h
|
||||||
include/dataManager.h
|
include/dataManager.h
|
||||||
include/componentIconManager.h
|
include/componentIconManager.h
|
||||||
|
include/basePropertyManager.h
|
||||||
../common/include/global.h
|
../common/include/global.h
|
||||||
|
../common/include/baseProperty.h
|
||||||
../common/include/compiler.hpp
|
../common/include/compiler.hpp
|
||||||
../common/include/export.hpp
|
../common/include/export.hpp
|
||||||
../common/include/operatingSystem.hpp
|
../common/include/operatingSystem.hpp
|
||||||
|
|
@ -14,8 +16,10 @@ set(DIAGRAMUTILS_SOURCE_FILES
|
||||||
source/logger.cpp
|
source/logger.cpp
|
||||||
source/dataBase.cpp
|
source/dataBase.cpp
|
||||||
source/dataManager.cpp
|
source/dataManager.cpp
|
||||||
|
source/basePropertyManager.cpp
|
||||||
source/componentIconManager.cpp
|
source/componentIconManager.cpp
|
||||||
../common/source/global.cpp
|
../common/source/global.cpp
|
||||||
|
../common/source/baseProperty.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef BASEPROPERTYMANAGER_H
|
||||||
|
#define BASEPROPERTYMANAGER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QMap>
|
||||||
|
#include "export.hpp"
|
||||||
|
/****元件属性数据管理类*****/
|
||||||
|
|
||||||
|
class BaseProperty;
|
||||||
|
|
||||||
|
class DIAGRAM_DESIGNER_PUBLIC BasePropertyManager : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit BasePropertyManager(QObject *parent = nullptr);
|
||||||
|
~BasePropertyManager();
|
||||||
|
|
||||||
|
static BasePropertyManager& instance();
|
||||||
|
|
||||||
|
//===========================元件实时数据================================
|
||||||
|
void insertEntityData(QUuid,BaseProperty*);
|
||||||
|
BaseProperty* findEntityData(QUuid);
|
||||||
|
void deleteEntityData(QUuid);
|
||||||
|
QMap<QUuid,BaseProperty*> getEntityData() const;
|
||||||
|
signals:
|
||||||
|
void dataCreated(QString uuid);
|
||||||
|
void dataChanged(QString uuid);
|
||||||
|
public slots:
|
||||||
|
void onDataDelete(QString uuid);
|
||||||
|
private:
|
||||||
|
QMap<QUuid,BaseProperty*> m_entityData; //每个实例化元件的唯一数据
|
||||||
|
};
|
||||||
|
#endif // BASEPROPERTYMANAGER_H
|
||||||
|
|
@ -26,23 +26,27 @@ public:
|
||||||
static DataBase* GetInstance();
|
static DataBase* GetInstance();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool insertPage(QString tag,QString name,int status,QJsonObject label,QJsonObject context,QString description,int op);
|
bool insertPage(QString tag,QString name,QJsonObject label,QJsonObject context,QString description,int op);
|
||||||
bool insertStation(int zoneId,QString name,QString description,bool isLocal,int op);
|
bool insertStation(int zoneId,QString name,QString description,bool isLocal,int op);
|
||||||
bool insertGrid(QString name,QString description,int op);
|
bool insertGrid(QString name,QString description,int op);
|
||||||
bool insertZone(int grid_id,QString name,QString description,int op);
|
bool insertZone(int grid_id,QString name,QString description,int op);
|
||||||
bool insertTopologic(int page_id,QUuid uuid_from,QUuid uuid_to,QUuid pin_from,QUuid pin_to,int flag,QString description,int op);
|
bool insertTopologic(QUuid uuid_from,QUuid uuid_to,QUuid from_pin,QUuid to_pin,int flag,QString description,int op);
|
||||||
|
|
||||||
QString getGridNameById(int);
|
QString getGridNameById(int);
|
||||||
QString getZoneNameById(int);
|
QString getZoneNameById(int);
|
||||||
QString getStationNameById(int);
|
QString getStationNameById(int);
|
||||||
|
|
||||||
|
QList<gridInfo> getAllGrid();
|
||||||
|
QList<zoneInfo> getAllZone();
|
||||||
|
QList<stationInfo> getAllStation();
|
||||||
|
|
||||||
QList<topologicInfo> getAllTopologics();
|
QList<topologicInfo> getAllTopologics();
|
||||||
int topologicExist(QUuid fromPin,QUuid toPin);
|
int topologicExist(QUuid fromPin,QUuid toPin);
|
||||||
topologicInfo getTopologicById(int id);
|
topologicInfo getTopologicById(int id);
|
||||||
bool deleteTopologic(QUuid fromPin,QUuid toPin);
|
bool deleteTopologic(QUuid fromPin,QUuid toPin);
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
bool updateComponent(QUuid uuid,QString tag,QString name,QJsonObject context);
|
bool updateComponent(QUuid uuid,QString tag,QString name,QJsonObject context);
|
||||||
bool insertComponent(QUuid uuid,QString modelName,QString nspath,QString tag,QString name,QString description,QString grid,QString zone,QString station,int type,bool inService,int state,QJsonObject connected_bus,QJsonObject label,QJsonObject context,int page_id,int op);
|
bool insertComponent(QUuid uuid,QString modelName,QString nspath,QString tag,QString name,QString description,QString grid,QString zone,QString station,int type,bool inService,int state,int status,QJsonObject connected_bus,QJsonObject label,QJsonObject context,int op);
|
||||||
bool insertDynamicProperty(QUuid uuid,groupStateValue groupValue);
|
bool insertDynamicProperty(QUuid uuid,groupStateValue groupValue);
|
||||||
bool updateDynamicProperty(QUuid uuid,groupStateValue groupValue);
|
bool updateDynamicProperty(QUuid uuid,groupStateValue groupValue);
|
||||||
componentInfo getComponentInfoByUuid(QString uuid);
|
componentInfo getComponentInfoByUuid(QString uuid);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
#include <QUuid>
|
||||||
|
#include "basePropertyManager.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
|
||||||
|
BasePropertyManager& BasePropertyManager::instance()
|
||||||
|
{
|
||||||
|
//采用静态局部变量的方式,静态局部变量的初始化是在第一次访问时,以后的调用不会多次初始化,并且生命周期和程序一致
|
||||||
|
static BasePropertyManager instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
BasePropertyManager::BasePropertyManager(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BasePropertyManager::~BasePropertyManager()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void BasePropertyManager::insertEntityData(QUuid uid,BaseProperty* p)
|
||||||
|
{
|
||||||
|
if(!m_entityData.contains(uid))
|
||||||
|
m_entityData.insert(uid,p);
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseProperty* BasePropertyManager::findEntityData(QUuid uid)
|
||||||
|
{
|
||||||
|
return m_entityData.value(uid,nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BasePropertyManager::deleteEntityData(QUuid uid)
|
||||||
|
{
|
||||||
|
BaseProperty* pData = m_entityData.value(uid,nullptr);
|
||||||
|
if(pData)
|
||||||
|
delete pData;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QUuid,BaseProperty*> BasePropertyManager::getEntityData() const
|
||||||
|
{
|
||||||
|
return m_entityData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BasePropertyManager::onDataDelete(QString uuid)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -226,7 +226,7 @@ QSqlQuery DataBase::executeBatchSQL(const QStringList& sqlStatements, bool creat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DataBase::insertComponent(QUuid uuid,QString modelName,QString nspath,QString tag,QString name,QString description,QString grid,QString zone,QString station,int type,bool inService,int state,QJsonObject connected_bus,QJsonObject label,QJsonObject context,int page_id,int op)
|
bool DataBase::insertComponent(QUuid uuid,QString modelName,QString nspath,QString tag,QString name,QString description,QString grid,QString zone,QString station,int type,bool inService,int state,int status,QJsonObject connected_bus,QJsonObject label,QJsonObject context,int op)
|
||||||
{
|
{
|
||||||
if(db.open())
|
if(db.open())
|
||||||
{
|
{
|
||||||
|
|
@ -235,7 +235,7 @@ bool DataBase::insertComponent(QUuid uuid,QString modelName,QString nspath,QStri
|
||||||
QJsonDocument contextDoc(context);
|
QJsonDocument contextDoc(context);
|
||||||
QString strCon = contextDoc.toJson(QJsonDocument::Compact);
|
QString strCon = contextDoc.toJson(QJsonDocument::Compact);
|
||||||
|
|
||||||
qry.prepare("INSERT INTO component(global_uuid, model_name,tag, name, grid, zone, station, type, context, page_id, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
qry.prepare("INSERT INTO component(global_uuid, model_name,tag, name, grid, zone, station, type, context, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
qry.bindValue(0,uuid);
|
qry.bindValue(0,uuid);
|
||||||
qry.bindValue(1,modelName);
|
qry.bindValue(1,modelName);
|
||||||
qry.bindValue(2,tag);
|
qry.bindValue(2,tag);
|
||||||
|
|
@ -245,9 +245,8 @@ bool DataBase::insertComponent(QUuid uuid,QString modelName,QString nspath,QStri
|
||||||
qry.bindValue(6,station);
|
qry.bindValue(6,station);
|
||||||
qry.bindValue(7,type);
|
qry.bindValue(7,type);
|
||||||
qry.bindValue(8,strCon);
|
qry.bindValue(8,strCon);
|
||||||
qry.bindValue(9,page_id);
|
qry.bindValue(9,op);
|
||||||
qry.bindValue(10,op);
|
qry.bindValue(10,QDateTime::currentDateTime());
|
||||||
qry.bindValue(11,QDateTime::currentDateTime());
|
|
||||||
bool res = qry.exec();
|
bool res = qry.exec();
|
||||||
QString str = qry.lastQuery();
|
QString str = qry.lastQuery();
|
||||||
const QVariantList list = qry.boundValues();
|
const QVariantList list = qry.boundValues();
|
||||||
|
|
@ -349,7 +348,7 @@ bool DataBase::updateDynamicProperty(QUuid uuid,groupStateValue groupValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataBase::insertPage(QString tag,QString name,int status,QJsonObject label,QJsonObject context,QString description,int op)
|
bool DataBase::insertPage(QString tag,QString name,QJsonObject label,QJsonObject context,QString description,int op)
|
||||||
{
|
{
|
||||||
if(db.open())
|
if(db.open())
|
||||||
{
|
{
|
||||||
|
|
@ -361,15 +360,14 @@ bool DataBase::insertPage(QString tag,QString name,int status,QJsonObject label,
|
||||||
QJsonDocument contextDoc(context);
|
QJsonDocument contextDoc(context);
|
||||||
QString strCon = contextDoc.toJson(QJsonDocument::Compact);
|
QString strCon = contextDoc.toJson(QJsonDocument::Compact);
|
||||||
|
|
||||||
qry.prepare("INSERT INTO page(tag, name, status, label, context, description, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
qry.prepare("INSERT INTO page(tag, name, label, context, description, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||||
qry.bindValue(0,tag);
|
qry.bindValue(0,tag);
|
||||||
qry.bindValue(1,name);
|
qry.bindValue(1,name);
|
||||||
qry.bindValue(2,status);
|
qry.bindValue(2,strLabel);
|
||||||
qry.bindValue(3,strLabel);
|
qry.bindValue(3,strCon);
|
||||||
qry.bindValue(4,strCon);
|
qry.bindValue(4,description);
|
||||||
qry.bindValue(5,description);
|
qry.bindValue(5,op);
|
||||||
qry.bindValue(6,op);
|
qry.bindValue(6,QDateTime::currentDateTime());
|
||||||
qry.bindValue(7,QDateTime::currentDateTime());
|
|
||||||
bool res = qry.exec();
|
bool res = qry.exec();
|
||||||
QString str = qry.lastQuery();
|
QString str = qry.lastQuery();
|
||||||
if(!res)
|
if(!res)
|
||||||
|
|
@ -457,21 +455,20 @@ bool DataBase::insertZone(int grid_id,QString name,QString description,int op)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataBase::insertTopologic(int page_id,QUuid uuid_from,QUuid uuid_to,QUuid pin_from,QUuid pin_to,int flag,QString description,int op)
|
bool DataBase::insertTopologic(QUuid uuid_from,QUuid uuid_to,QUuid from_pin,QUuid to_pin,int flag,QString description,int op)
|
||||||
{
|
{
|
||||||
if(db.open())
|
if(db.open())
|
||||||
{
|
{
|
||||||
QSqlQuery qry(db);
|
QSqlQuery qry(db);
|
||||||
qry.prepare("INSERT INTO topologic(page_id, uuid_from, uuid_to, pin_from, pin_to, flag, description, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);");
|
qry.prepare("INSERT INTO topologic(uuid_from, uuid_to, from_pin, to_pin, flag, description, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
|
||||||
qry.bindValue(0,page_id);
|
qry.bindValue(0,uuid_from);
|
||||||
qry.bindValue(1,uuid_from);
|
qry.bindValue(1,uuid_to);
|
||||||
qry.bindValue(2,uuid_to);
|
qry.bindValue(2,from_pin);
|
||||||
qry.bindValue(3,pin_from);
|
qry.bindValue(3,to_pin);
|
||||||
qry.bindValue(4,pin_to);
|
qry.bindValue(4,flag);
|
||||||
qry.bindValue(5,flag);
|
qry.bindValue(5,description);
|
||||||
qry.bindValue(6,description);
|
qry.bindValue(6,op);
|
||||||
qry.bindValue(7,op);
|
qry.bindValue(7,QDateTime::currentDateTime());
|
||||||
qry.bindValue(8,QDateTime::currentDateTime());
|
|
||||||
bool res = qry.exec();
|
bool res = qry.exec();
|
||||||
QString str = qry.lastQuery();
|
QString str = qry.lastQuery();
|
||||||
if(!res)
|
if(!res)
|
||||||
|
|
@ -554,10 +551,88 @@ QString DataBase::getStationNameById(int id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<gridInfo> DataBase::getAllGrid()
|
||||||
|
{
|
||||||
|
QList<gridInfo> lst;
|
||||||
|
QString strSQL = "SELECT id, name, description FROM grid";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QSqlQuery query = executeSQL(strSQL);
|
||||||
|
while (query.next())
|
||||||
|
{
|
||||||
|
gridInfo info;
|
||||||
|
info.id = query.value(0).toInt();
|
||||||
|
info.name = query.value(1).toString();
|
||||||
|
info.description = query.value(2).toString();
|
||||||
|
lst.append(info);
|
||||||
|
}
|
||||||
|
query.clear();
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<zoneInfo> DataBase::getAllZone()
|
||||||
|
{
|
||||||
|
QList<zoneInfo> lst;
|
||||||
|
QString strSQL = "SELECT id,grid_id,name,description FROM zone";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QSqlQuery query = executeSQL(strSQL);
|
||||||
|
while (query.next())
|
||||||
|
{
|
||||||
|
zoneInfo info;
|
||||||
|
info.id = query.value(0).toInt();
|
||||||
|
info.grid_id = query.value(1).toInt();
|
||||||
|
info.name = query.value(2).toString();
|
||||||
|
info.description = query.value(3).toString();
|
||||||
|
lst.append(info);
|
||||||
|
}
|
||||||
|
query.clear();
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<stationInfo> DataBase::getAllStation()
|
||||||
|
{
|
||||||
|
QList<stationInfo> lst;
|
||||||
|
QString strSQL = "SELECT id,zone_id,name,description,is_local FROM station";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QSqlQuery query = executeSQL(strSQL);
|
||||||
|
while (query.next())
|
||||||
|
{
|
||||||
|
stationInfo info;
|
||||||
|
info.id = query.value(0).toInt();
|
||||||
|
info.zone_id = query.value(1).toInt();
|
||||||
|
info.name = query.value(2).toString();
|
||||||
|
info.description = query.value(3).toString();
|
||||||
|
info.is_local = query.value(4).toBool();
|
||||||
|
lst.append(info);
|
||||||
|
}
|
||||||
|
query.clear();
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QList<topologicInfo> DataBase::getAllTopologics()
|
QList<topologicInfo> DataBase::getAllTopologics()
|
||||||
{
|
{
|
||||||
QList<topologicInfo> lst;
|
QList<topologicInfo> lst;
|
||||||
QString strSQL = "SELECT id,uuid_from,uuid_to,pin_from,pin_to,flag FROM topologic";
|
QString strSQL = "SELECT id,uuid_from,uuid_to,from_pin,to_pin,flag FROM topologic";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -568,8 +643,8 @@ QList<topologicInfo> DataBase::getAllTopologics()
|
||||||
info.id = query.value(0).toInt();
|
info.id = query.value(0).toInt();
|
||||||
info.uuid_from = QUuid(query.value(1).toString());
|
info.uuid_from = QUuid(query.value(1).toString());
|
||||||
info.uuid_to = QUuid(query.value(2).toString());
|
info.uuid_to = QUuid(query.value(2).toString());
|
||||||
info.pin_from = QUuid(query.value(3).toString());
|
info.from_pin = QUuid(query.value(3).toString());
|
||||||
info.pin_to = QUuid(query.value(4).toString());
|
info.to_pin = QUuid(query.value(4).toString());
|
||||||
info.flag = query.value(5).toInt();
|
info.flag = query.value(5).toInt();
|
||||||
|
|
||||||
lst.append(info);
|
lst.append(info);
|
||||||
|
|
@ -585,7 +660,7 @@ QList<topologicInfo> DataBase::getAllTopologics()
|
||||||
|
|
||||||
int DataBase::topologicExist(QUuid fromPin,QUuid toPin)
|
int DataBase::topologicExist(QUuid fromPin,QUuid toPin)
|
||||||
{
|
{
|
||||||
QString strSQL = "SELECT id FROM topologic WHERE pin_from = ? AND pin_to = ?";
|
QString strSQL = "SELECT id FROM topologic WHERE from_pin = ? AND to_pin = ?";
|
||||||
QVariantList params;
|
QVariantList params;
|
||||||
params.append(fromPin.toString());
|
params.append(fromPin.toString());
|
||||||
params.append(toPin.toString());
|
params.append(toPin.toString());
|
||||||
|
|
@ -610,7 +685,7 @@ int DataBase::topologicExist(QUuid fromPin,QUuid toPin)
|
||||||
topologicInfo DataBase::getTopologicById(int id)
|
topologicInfo DataBase::getTopologicById(int id)
|
||||||
{
|
{
|
||||||
topologicInfo info;
|
topologicInfo info;
|
||||||
QString strSQL = "SELECT id,uuid_from,uuid_to,pin_from,pin_to,flag FROM topologic WHERE id = ?";
|
QString strSQL = "SELECT id,uuid_from,uuid_to,from_pin,to_pin,flag FROM topologic WHERE id = ?";
|
||||||
QVariantList params;
|
QVariantList params;
|
||||||
params.append(id);
|
params.append(id);
|
||||||
|
|
||||||
|
|
@ -622,8 +697,8 @@ topologicInfo DataBase::getTopologicById(int id)
|
||||||
info.id = query.value(0).toInt();
|
info.id = query.value(0).toInt();
|
||||||
info.uuid_from = QUuid(query.value(1).toString());
|
info.uuid_from = QUuid(query.value(1).toString());
|
||||||
info.uuid_to = QUuid(query.value(2).toString());
|
info.uuid_to = QUuid(query.value(2).toString());
|
||||||
info.pin_from = QUuid(query.value(3).toString());
|
info.from_pin = QUuid(query.value(3).toString());
|
||||||
info.pin_to = QUuid(query.value(4).toString());
|
info.to_pin = QUuid(query.value(4).toString());
|
||||||
info.flag = query.value(5).toInt();
|
info.flag = query.value(5).toInt();
|
||||||
}
|
}
|
||||||
query.clear();
|
query.clear();
|
||||||
|
|
@ -637,7 +712,7 @@ topologicInfo DataBase::getTopologicById(int id)
|
||||||
|
|
||||||
bool DataBase::deleteTopologic(QUuid fromPin,QUuid toPin)
|
bool DataBase::deleteTopologic(QUuid fromPin,QUuid toPin)
|
||||||
{
|
{
|
||||||
QString strSQL = "DELETE FROM topologic WHERE pin_from = ? AND pin_to = ?";
|
QString strSQL = "DELETE FROM topologic WHERE from_pin = ? AND to_pin = ?";
|
||||||
QVariantList params;
|
QVariantList params;
|
||||||
params.append(fromPin.toString());
|
params.append(fromPin.toString());
|
||||||
params.append(toPin.toString());
|
params.append(toPin.toString());
|
||||||
|
|
@ -664,7 +739,7 @@ componentInfo DataBase::getComponentInfoByUuid(QString uuid)
|
||||||
QSqlQuery qry(db);
|
QSqlQuery qry(db);
|
||||||
|
|
||||||
//qry.prepare("SELECT * FROM component WHERE global_uuid = ?");
|
//qry.prepare("SELECT * FROM component WHERE global_uuid = ?");
|
||||||
qry.prepare("SELECT id, global_uuid, model_name, tag, name, grid, zone, station, type, context, page_id, op FROM component WHERE global_uuid = ?");
|
qry.prepare("SELECT id, global_uuid, model_name, tag, name, grid, zone, station, type, context, op FROM component WHERE global_uuid = ?");
|
||||||
qry.bindValue(0,uuid);
|
qry.bindValue(0,uuid);
|
||||||
bool res = qry.exec();
|
bool res = qry.exec();
|
||||||
QString str = qry.lastQuery();
|
QString str = qry.lastQuery();
|
||||||
|
|
@ -688,8 +763,7 @@ componentInfo DataBase::getComponentInfoByUuid(QString uuid)
|
||||||
inf.type = qry.value(8).toInt();
|
inf.type = qry.value(8).toInt();
|
||||||
QString str = qry.value(9).toString();
|
QString str = qry.value(9).toString();
|
||||||
inf.context = QstringToJson(str);
|
inf.context = QstringToJson(str);
|
||||||
inf.page_id = qry.value(10).toInt();
|
inf.op = qry.value(10).toInt();
|
||||||
inf.op = qry.value(11).toInt();
|
|
||||||
qry.clear();
|
qry.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -704,7 +778,7 @@ QList<componentInfo> DataBase::getAllComponents()
|
||||||
{
|
{
|
||||||
QSqlQuery qry(db);
|
QSqlQuery qry(db);
|
||||||
|
|
||||||
qry.prepare("SELECT id, global_uuid, model_name,tag, name, grid, zone, station, type, context, page_id, op FROM component");
|
qry.prepare("SELECT id, global_uuid, model_name,tag, name, grid, zone, station, type, context, op FROM component");
|
||||||
bool res = qry.exec();
|
bool res = qry.exec();
|
||||||
QString str = qry.lastQuery();
|
QString str = qry.lastQuery();
|
||||||
if(!res)
|
if(!res)
|
||||||
|
|
@ -728,8 +802,7 @@ QList<componentInfo> DataBase::getAllComponents()
|
||||||
inf.type = qry.value(8).toInt();
|
inf.type = qry.value(8).toInt();
|
||||||
QString str = qry.value(9).toString();
|
QString str = qry.value(9).toString();
|
||||||
inf.context = QstringToJson(str);
|
inf.context = QstringToJson(str);
|
||||||
inf.page_id = qry.value(10).toInt();
|
inf.op = qry.value(10).toInt();
|
||||||
inf.op = qry.value(11).toInt();
|
|
||||||
lst.push_back(inf);
|
lst.push_back(inf);
|
||||||
}
|
}
|
||||||
qry.clear();
|
qry.clear();
|
||||||
|
|
@ -883,7 +956,7 @@ QJsonObject DataBase::getPageContextByName(QString name)
|
||||||
QList<pageInfo> DataBase::getAllPage()
|
QList<pageInfo> DataBase::getAllPage()
|
||||||
{
|
{
|
||||||
QList<pageInfo> lst;
|
QList<pageInfo> lst;
|
||||||
QString strSQL = "SELECT id,tag,name,status,label,context,description,op FROM page";
|
QString strSQL = "SELECT id,tag,name,label,context,description,op FROM page";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -894,13 +967,12 @@ QList<pageInfo> DataBase::getAllPage()
|
||||||
info.id = query.value(0).toInt();
|
info.id = query.value(0).toInt();
|
||||||
info.tag = query.value(1).toString();
|
info.tag = query.value(1).toString();
|
||||||
info.name = query.value(2).toString();
|
info.name = query.value(2).toString();
|
||||||
info.status = query.value(3).toInt();
|
QString label = query.value(3).toString();
|
||||||
QString label = query.value(4).toString();
|
|
||||||
info.label = QstringToJson(label);
|
info.label = QstringToJson(label);
|
||||||
QString context = query.value(5).toString();
|
QString context = query.value(4).toString();
|
||||||
info.context = QstringToJson(context);
|
info.context = QstringToJson(context);
|
||||||
info.description = query.value(6).toString();
|
info.description = query.value(5).toString();
|
||||||
info.op = query.value(7).toInt();
|
info.op = query.value(6).toInt();
|
||||||
|
|
||||||
lst.append(info);
|
lst.append(info);
|
||||||
}
|
}
|
||||||
|
|
@ -1250,6 +1322,7 @@ bool DataBase::getAttribute()
|
||||||
int inn = query.value(6).toInt(); //非空
|
int inn = query.value(6).toInt(); //非空
|
||||||
QString dv = query.value(7).toString(); //默认值
|
QString dv = query.value(7).toString(); //默认值
|
||||||
QString vr = query.value(8).toString(); //范围
|
QString vr = query.value(8).toString(); //范围
|
||||||
|
int visible = query.value(9).toInt();
|
||||||
|
|
||||||
if(!_attribute.contains(id))
|
if(!_attribute.contains(id))
|
||||||
{
|
{
|
||||||
|
|
@ -1263,6 +1336,7 @@ bool DataBase::getAttribute()
|
||||||
attribute.isNotNull = inn;
|
attribute.isNotNull = inn;
|
||||||
attribute.defaultValue = dv;
|
attribute.defaultValue = dv;
|
||||||
attribute.valueRange = vr;
|
attribute.valueRange = vr;
|
||||||
|
attribute.isVisible = visible;
|
||||||
|
|
||||||
_attribute.insert(id,attribute);
|
_attribute.insert(id,attribute);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ private slots:
|
||||||
void onAction_createGroup();
|
void onAction_createGroup();
|
||||||
void onAction_destroyGroup();
|
void onAction_destroyGroup();
|
||||||
void onAction_editProject();
|
void onAction_editProject();
|
||||||
|
void onAction_editBay();
|
||||||
void onSignal_addItem(QGraphicsItem*);
|
void onSignal_addItem(QGraphicsItem*);
|
||||||
void onSignal_deleteItem();
|
void onSignal_deleteItem();
|
||||||
void onSignal_loadPage();
|
void onSignal_loadPage();
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,14 @@ public:
|
||||||
QString selectedComponent() const {
|
QString selectedComponent() const {
|
||||||
return m_selectedComponent;
|
return m_selectedComponent;
|
||||||
}
|
}
|
||||||
|
modelType selectedMeta() const {
|
||||||
|
return m_selectedMeta;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QListView* m_listView;
|
QListView* m_listView;
|
||||||
QString m_selectedComponent;
|
QString m_selectedComponent;
|
||||||
|
modelType m_selectedMeta;
|
||||||
QDialogButtonBox* m_buttonBox;
|
QDialogButtonBox* m_buttonBox;
|
||||||
SelectorDialogType m_dlgType;
|
SelectorDialogType m_dlgType;
|
||||||
|
|
||||||
|
|
@ -26,7 +31,7 @@ private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
QStandardItemModel * initialModel();
|
QStandardItemModel * initialModel();
|
||||||
private:
|
private:
|
||||||
QStringList getMetaList() const;
|
QList<modelType> getMetaList() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //SELECTORDIALOG_H
|
#endif //SELECTORDIALOG_H
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,11 @@ public slots:
|
||||||
void onIndexRbtnClicked(const QPoint &pos); //索引列表右键菜单
|
void onIndexRbtnClicked(const QPoint &pos); //索引列表右键菜单
|
||||||
void onItemChanged(QStandardItem *item);
|
void onItemChanged(QStandardItem *item);
|
||||||
void onItemClicked(const QModelIndex &index);
|
void onItemClicked(const QModelIndex &index);
|
||||||
|
|
||||||
|
void onDataCreated(QString uuid);
|
||||||
|
void onDataChanged(QString uuid);
|
||||||
|
private:
|
||||||
|
void addItemToView(QString sGrid,QString sZone,QString sStation,QStandardItem *root,QStandardItem *item);
|
||||||
private:
|
private:
|
||||||
Ui::topologyView *ui;
|
Ui::topologyView *ui;
|
||||||
QStandardItemModel* _pModel;
|
QStandardItemModel* _pModel;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
#include <mainwindow.h>
|
#include <mainwindow.h>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
CMainWindow w;
|
CMainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
qRegisterMetaType<propertyStateInfo>("propertyStateInfo");
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,9 @@ void CMainWindow::initializeAction()
|
||||||
|
|
||||||
QAction* actEdit = ui->menuProject->addAction(QString::fromWCharArray(L"编辑工程模"));
|
QAction* actEdit = ui->menuProject->addAction(QString::fromWCharArray(L"编辑工程模"));
|
||||||
connect(actEdit,&QAction::triggered,this,&CMainWindow::onAction_editProject);
|
connect(actEdit,&QAction::triggered,this,&CMainWindow::onAction_editProject);
|
||||||
|
|
||||||
|
QAction* actEditBay = ui->menuBay->addAction(QString::fromWCharArray(L"编辑间隔"));
|
||||||
|
connect(actEditBay,&QAction::triggered,this,&CMainWindow::onAction_editBay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::onAction_zoomIn()
|
void CMainWindow::onAction_zoomIn()
|
||||||
|
|
@ -198,6 +201,11 @@ void CMainWindow::onAction_editProject()
|
||||||
m_pProjectModelDlg->show();
|
m_pProjectModelDlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMainWindow::onAction_editBay()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CMainWindow::onSignal_addItem(QGraphicsItem* item)
|
void CMainWindow::onSignal_addItem(QGraphicsItem* item)
|
||||||
{
|
{
|
||||||
if(item)
|
if(item)
|
||||||
|
|
|
||||||
|
|
@ -904,7 +904,8 @@ void projectModelDlg::onTableItemClicked(QTableWidgetItem *item)
|
||||||
}
|
}
|
||||||
if(strMeta != "未选择")
|
if(strMeta != "未选择")
|
||||||
{
|
{
|
||||||
_curMeta = strMeta;
|
QString sMeta = ui->tableWidget_model->item(row, 1)->data(Qt::EditRole+1).toString();
|
||||||
|
_curMeta = sMeta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(col == TD_ComponentType) //类型选择
|
else if(col == TD_ComponentType) //类型选择
|
||||||
|
|
@ -1286,6 +1287,7 @@ void projectModelDlg::setItemAttribute(const QString& name,QStandardItem* p)
|
||||||
p->setData(att.isNotNull,IsNotNull);
|
p->setData(att.isNotNull,IsNotNull);
|
||||||
p->setData(att.defaultValue,DefaultValue);
|
p->setData(att.defaultValue,DefaultValue);
|
||||||
p->setData(att.valueRange,ValueRange);
|
p->setData(att.valueRange,ValueRange);
|
||||||
|
p->setData(att.isVisible,IsVisible);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1625,6 +1627,7 @@ QJsonObject projectModelDlg::getSelectedState(QList<QStandardItem*> select,QList
|
||||||
int lengthPrecision = item->data(LengthPrecision).toInt();
|
int lengthPrecision = item->data(LengthPrecision).toInt();
|
||||||
int scale = item->data(Scale).toInt();
|
int scale = item->data(Scale).toInt();
|
||||||
QString defaultValue = item->data(DefaultValue).toString();
|
QString defaultValue = item->data(DefaultValue).toString();
|
||||||
|
int isVisible = item->data(IsVisible).toInt();
|
||||||
|
|
||||||
QString dataTypePart = dataType; //拼接数据类型
|
QString dataTypePart = dataType; //拼接数据类型
|
||||||
if (lengthPrecision > 0) {
|
if (lengthPrecision > 0) {
|
||||||
|
|
@ -1641,6 +1644,7 @@ QJsonObject projectModelDlg::getSelectedState(QList<QStandardItem*> select,QList
|
||||||
node["type"] = dataTypePart;
|
node["type"] = dataTypePart;
|
||||||
node["defaultValue"] = defaultValue;
|
node["defaultValue"] = defaultValue;
|
||||||
node["lengthPrecision"] = lengthPrecision;
|
node["lengthPrecision"] = lengthPrecision;
|
||||||
|
node["isVisible"] = isVisible;
|
||||||
arrState.append(node);
|
arrState.append(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1650,6 +1654,7 @@ QJsonObject projectModelDlg::getSelectedState(QList<QStandardItem*> select,QList
|
||||||
int lengthPrecision = item->data(LengthPrecision).toInt();
|
int lengthPrecision = item->data(LengthPrecision).toInt();
|
||||||
int scale = item->data(Scale).toInt();
|
int scale = item->data(Scale).toInt();
|
||||||
QString defaultValue = item->data(DefaultValue).toString();
|
QString defaultValue = item->data(DefaultValue).toString();
|
||||||
|
int isVisible = item->data(IsVisible).toInt();
|
||||||
|
|
||||||
QString dataTypePart = dataType; //拼接数据类型
|
QString dataTypePart = dataType; //拼接数据类型
|
||||||
if (lengthPrecision > 0) {
|
if (lengthPrecision > 0) {
|
||||||
|
|
@ -1666,6 +1671,7 @@ QJsonObject projectModelDlg::getSelectedState(QList<QStandardItem*> select,QList
|
||||||
node["type"] = dataTypePart;
|
node["type"] = dataTypePart;
|
||||||
node["defaultValue"] = defaultValue;
|
node["defaultValue"] = defaultValue;
|
||||||
node["lengthPrecision"] = lengthPrecision;
|
node["lengthPrecision"] = lengthPrecision;
|
||||||
|
node["isVisible"] = isVisible;
|
||||||
arrState.append(node);
|
arrState.append(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,11 @@ bool ProjectTableDelegate::editorEvent(QEvent* event, QAbstractItemModel* model,
|
||||||
SelectorDialog dialog(option.widget->parentWidget()->parentWidget()->parentWidget()->parentWidget());
|
SelectorDialog dialog(option.widget->parentWidget()->parentWidget()->parentWidget()->parentWidget());
|
||||||
dialog.initial(ST_MetaModel);
|
dialog.initial(ST_MetaModel);
|
||||||
if(dialog.exec() == QDialog::Accepted) {
|
if(dialog.exec() == QDialog::Accepted) {
|
||||||
QString component = dialog.selectedComponent();
|
modelType meta = dialog.selectedMeta();
|
||||||
if(!component.isEmpty()) {
|
if(!meta.modelType.isEmpty()) {
|
||||||
model->setData(index, component, Qt::EditRole);
|
model->setData(index, meta.modelName, Qt::EditRole);
|
||||||
emit editingFinished(index,component);
|
model->setData(index, meta.modelType, Qt::EditRole+1);
|
||||||
|
emit editingFinished(index,meta.modelType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,13 @@ QStandardItemModel * SelectorDialog::initialModel()
|
||||||
{
|
{
|
||||||
QStandardItemModel *model = new QStandardItemModel(this);
|
QStandardItemModel *model = new QStandardItemModel(this);
|
||||||
if(m_dlgType == ST_MetaModel){
|
if(m_dlgType == ST_MetaModel){
|
||||||
QStringList metas = getMetaList();
|
QList<modelType> metas = getMetaList();
|
||||||
for(auto &meta:metas)
|
for(auto &meta:metas)
|
||||||
{
|
{
|
||||||
QStandardItem *item = new QStandardItem();
|
QStandardItem *item = new QStandardItem();
|
||||||
//item->setIcon(QIcon(":/icons/folder.png")); // 设置图标
|
//item->setIcon(QIcon(":/icons/folder.png")); // 设置图标
|
||||||
item->setText(meta); // 设置文本
|
item->setText(meta.modelName); // 设置文本
|
||||||
|
item->setData(meta.modelType,Qt::UserRole);
|
||||||
model->appendRow(item);
|
model->appendRow(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -65,13 +66,25 @@ QStandardItemModel * SelectorDialog::initialModel()
|
||||||
|
|
||||||
void SelectorDialog::setupConnections() {
|
void SelectorDialog::setupConnections() {
|
||||||
connect(m_listView, &QListView::doubleClicked, [this](const QModelIndex& index){
|
connect(m_listView, &QListView::doubleClicked, [this](const QModelIndex& index){
|
||||||
m_selectedComponent = index.data().toString();
|
if(m_dlgType == ST_MetaModel){
|
||||||
|
m_selectedMeta.modelName = index.data().toString();
|
||||||
|
m_selectedMeta.modelType = index.data(Qt::UserRole).toString();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
m_selectedComponent = index.data().toString();
|
||||||
|
}
|
||||||
accept();
|
accept();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_buttonBox, &QDialogButtonBox::accepted, [this]{
|
connect(m_buttonBox, &QDialogButtonBox::accepted, [this]{
|
||||||
if(auto index = m_listView->currentIndex(); index.isValid()) {
|
if(auto index = m_listView->currentIndex(); index.isValid()) {
|
||||||
m_selectedComponent = index.data().toString();
|
if(m_dlgType == ST_MetaModel){
|
||||||
|
m_selectedMeta.modelName = index.data().toString();
|
||||||
|
m_selectedMeta.modelType = index.data(Qt::UserRole).toString();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
m_selectedComponent = index.data().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
accept();
|
accept();
|
||||||
});
|
});
|
||||||
|
|
@ -79,16 +92,16 @@ void SelectorDialog::setupConnections() {
|
||||||
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SelectorDialog::getMetaList() const
|
QList<modelType> SelectorDialog::getMetaList() const
|
||||||
{
|
{
|
||||||
QMap<int,modelType> modelMap = DataBase::GetInstance()->ModelType();
|
QMap<int,modelType> modelMap = DataBase::GetInstance()->ModelType();
|
||||||
|
|
||||||
QSet<QString> modelSet;
|
QList<modelType> modelSet;
|
||||||
for(auto &model:modelMap)
|
for(auto &model:modelMap)
|
||||||
{
|
{
|
||||||
modelSet.insert(model.modelType);
|
modelSet.append(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QStringList(modelSet.values());
|
return modelSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "topologyTree.h"
|
#include "topologyTree.h"
|
||||||
#include "dataBase.h"
|
#include "dataBase.h"
|
||||||
|
#include "basePropertyManager.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
@ -32,6 +34,8 @@ void TopologyView::initial()
|
||||||
connect(_treeView, &QTreeView::customContextMenuRequested, this, &TopologyView::onIndexRbtnClicked);
|
connect(_treeView, &QTreeView::customContextMenuRequested, this, &TopologyView::onIndexRbtnClicked);
|
||||||
connect(_treeView, &QTreeView::clicked, this, &TopologyView::onItemClicked);
|
connect(_treeView, &QTreeView::clicked, this, &TopologyView::onItemClicked);
|
||||||
connect(_pModel, &QStandardItemModel::itemChanged, this, &TopologyView::onItemChanged);
|
connect(_pModel, &QStandardItemModel::itemChanged, this, &TopologyView::onItemChanged);
|
||||||
|
connect(&BasePropertyManager::instance(),&BasePropertyManager::dataChanged,this,&TopologyView::onDataChanged);
|
||||||
|
|
||||||
_treeView->setHeaderHidden(true);
|
_treeView->setHeaderHidden(true);
|
||||||
// 设置模型的列数
|
// 设置模型的列数
|
||||||
_pModel->setColumnCount(1);
|
_pModel->setColumnCount(1);
|
||||||
|
|
@ -39,11 +43,7 @@ void TopologyView::initial()
|
||||||
// 设置模型的标题
|
// 设置模型的标题
|
||||||
//_pModel->setHeaderData(0, Qt::Horizontal, QObject::tr("层级"));
|
//_pModel->setHeaderData(0, Qt::Horizontal, QObject::tr("层级"));
|
||||||
|
|
||||||
// 创建根节点
|
QStandardItem *rootItem = _pModel->invisibleRootItem();
|
||||||
QStandardItem *rootItem = new QStandardItem("电网");
|
|
||||||
rootItem->setFlags(rootItem->flags() & ~Qt::ItemIsEditable);
|
|
||||||
_pModel->appendRow(rootItem);
|
|
||||||
|
|
||||||
QList<componentInfo> lst= DataBase::GetInstance()->getAllComponents();
|
QList<componentInfo> lst= DataBase::GetInstance()->getAllComponents();
|
||||||
for(auto &info:lst)
|
for(auto &info:lst)
|
||||||
{
|
{
|
||||||
|
|
@ -55,49 +55,9 @@ void TopologyView::initial()
|
||||||
QString sZone = DataBase::GetInstance()->getZoneNameById(nZ.toInt());
|
QString sZone = DataBase::GetInstance()->getZoneNameById(nZ.toInt());
|
||||||
QString sStation = DataBase::GetInstance()->getStationNameById(nS.toInt());
|
QString sStation = DataBase::GetInstance()->getStationNameById(nS.toInt());
|
||||||
|
|
||||||
QModelIndex iG = findIndex(_pModel,sGrid);
|
|
||||||
QModelIndex iZ = findIndex(_pModel,sZone);
|
|
||||||
QModelIndex iS = findIndex(_pModel,sStation);
|
|
||||||
|
|
||||||
QStandardItem *pItem = new QStandardItem(info.tag);
|
QStandardItem *pItem = new QStandardItem(info.tag);
|
||||||
pItem->setData(info.uuid,Qt::UserRole);
|
pItem->setData(info.uuid.toString(),Qt::UserRole);
|
||||||
if(iG.isValid()) //已创建
|
addItemToView(sGrid,sZone,sStation,rootItem,pItem);
|
||||||
{
|
|
||||||
QStandardItem* itemGrid = _pModel->itemFromIndex(iG);
|
|
||||||
if(iZ.isValid())
|
|
||||||
{
|
|
||||||
QStandardItem* itemZone = _pModel->itemFromIndex(iZ);
|
|
||||||
if(iS.isValid())
|
|
||||||
{
|
|
||||||
QStandardItem* itemStation = _pModel->itemFromIndex(iS);
|
|
||||||
itemStation->appendRow(pItem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QStandardItem* itemStation = new QStandardItem(sStation);
|
|
||||||
itemStation->appendRow(pItem);
|
|
||||||
itemZone->appendRow(itemStation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QStandardItem* itemZone = new QStandardItem(sZone);
|
|
||||||
QStandardItem* itemStation = new QStandardItem(sStation);
|
|
||||||
itemStation->appendRow(pItem);
|
|
||||||
itemZone->appendRow(itemStation);
|
|
||||||
itemGrid->appendRow(itemZone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QStandardItem* itemGrid = new QStandardItem(sGrid);
|
|
||||||
QStandardItem* itemZone = new QStandardItem(sZone);
|
|
||||||
QStandardItem* itemStation = new QStandardItem(sStation);
|
|
||||||
itemStation->appendRow(pItem);
|
|
||||||
itemZone->appendRow(itemStation);
|
|
||||||
itemGrid->appendRow(itemZone);
|
|
||||||
rootItem->appendRow(itemGrid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建树视图
|
// 创建树视图
|
||||||
|
|
@ -197,54 +157,6 @@ void TopologyView::onIndexRbtnClicked(const QPoint &pos)
|
||||||
|
|
||||||
menu.addAction(addAction);
|
menu.addAction(addAction);
|
||||||
}
|
}
|
||||||
else if(nLevel == 3) //station
|
|
||||||
{
|
|
||||||
/*QAction *addAction = new QAction("添加组态图", this);
|
|
||||||
QString sParentid = item->data(Qt::UserRole+1).toString();
|
|
||||||
|
|
||||||
connect(addAction,&QAction::triggered,this,[&](){
|
|
||||||
QString uuid = QUuid::createUuid().toString();
|
|
||||||
QStandardItem *diagramItem = new QStandardItem(QString("组态图_")+QString::number(nCount));
|
|
||||||
diagramItem->setData(uuid,Qt::UserRole+1);
|
|
||||||
diagramItem->setData(int(EntityType::ConfigurationDiagram),Qt::UserRole+2);
|
|
||||||
item->appendRow(diagramItem);
|
|
||||||
|
|
||||||
EntityInfo info;
|
|
||||||
info.eType = EntityType::ConfigurationDiagram;
|
|
||||||
info.sName = diagramItem->text();
|
|
||||||
info.sUuid = uuid;
|
|
||||||
info.sParentId = sParentid;
|
|
||||||
emit entityCreate(info);
|
|
||||||
|
|
||||||
_treeView->expandAll();
|
|
||||||
});
|
|
||||||
|
|
||||||
menu.addAction(addAction);*/
|
|
||||||
}
|
|
||||||
else if(nLevel == 4) //组态图
|
|
||||||
{
|
|
||||||
/*QAction *addAction = new QAction("添加子组态图", this);
|
|
||||||
QString sText = item->text();
|
|
||||||
QString sParentid = item->data(Qt::UserRole+1).toString();
|
|
||||||
connect(addAction,&QAction::triggered,this,[&](){
|
|
||||||
QString uuid = QUuid::createUuid().toString();
|
|
||||||
QStandardItem *diagramItem = new QStandardItem(sText+QString("_")+QString::number(nCount));
|
|
||||||
diagramItem->setData(uuid,Qt::UserRole+1);
|
|
||||||
diagramItem->setData(int(EntityType::ConfigurationDiagram),Qt::UserRole+2);
|
|
||||||
item->appendRow(diagramItem);
|
|
||||||
|
|
||||||
EntityInfo info;
|
|
||||||
info.eType = EntityType::ConfigurationDiagram;
|
|
||||||
info.sName = diagramItem->text();
|
|
||||||
info.sUuid = uuid;
|
|
||||||
info.sParentId = sParentid;
|
|
||||||
emit entityCreate(info);
|
|
||||||
|
|
||||||
_treeView->expandAll();
|
|
||||||
});
|
|
||||||
|
|
||||||
menu.addAction(addAction);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nLevel != -1) //除了根节点其余都能删除
|
if(nLevel != -1) //除了根节点其余都能删除
|
||||||
{
|
{
|
||||||
|
|
@ -307,3 +219,92 @@ void TopologyView::onItemClicked(const QModelIndex &index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TopologyView::onDataCreated(QString uuid)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TopologyView::onDataChanged(QString uuid)
|
||||||
|
{
|
||||||
|
QModelIndex itemIndex = findIndex(_pModel,uuid,Qt::UserRole);
|
||||||
|
BaseProperty* pData = BasePropertyManager::instance().findEntityData(QUuid(uuid));
|
||||||
|
if(pData)
|
||||||
|
{
|
||||||
|
if(itemIndex.isValid()) //已存在
|
||||||
|
{
|
||||||
|
QStandardItem *pItem = _pModel->itemFromIndex(itemIndex);
|
||||||
|
if(pItem)
|
||||||
|
{
|
||||||
|
if(pItem->text() != pData->tag()) //已改名
|
||||||
|
{
|
||||||
|
pItem->setText(pData->tag());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString sStation = pItem->parent()->text();
|
||||||
|
QString sZone = pItem->parent()->parent()->text();
|
||||||
|
QString sGrid = pItem->parent()->parent()->parent()->text();
|
||||||
|
if(sStation == pData->station() && sZone == pData->zone() && sGrid == pData->grid()) //从属关系未变
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStandardItem* item = _pModel->takeItem(pItem->row()); //从原层级中取出,添加到新的层级
|
||||||
|
addItemToView(pData->grid(),pData->zone(),pData->station(),_pModel->invisibleRootItem(),item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStandardItem *pItem = new QStandardItem(pData->tag());
|
||||||
|
pItem->setData(uuid,Qt::UserRole);
|
||||||
|
addItemToView(pData->grid(),pData->zone(),pData->station(),_pModel->invisibleRootItem(),pItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TopologyView::addItemToView(QString sGrid,QString sZone,QString sStation,QStandardItem *root,QStandardItem *pItem)
|
||||||
|
{
|
||||||
|
QModelIndex iG = findIndex(_pModel,sGrid);
|
||||||
|
QModelIndex iZ = findIndex(_pModel,sZone);
|
||||||
|
QModelIndex iS = findIndex(_pModel,sStation);
|
||||||
|
|
||||||
|
if(iG.isValid()) //已创建
|
||||||
|
{
|
||||||
|
QStandardItem* itemGrid = _pModel->itemFromIndex(iG);
|
||||||
|
if(iZ.isValid())
|
||||||
|
{
|
||||||
|
QStandardItem* itemZone = _pModel->itemFromIndex(iZ);
|
||||||
|
if(iS.isValid())
|
||||||
|
{
|
||||||
|
QStandardItem* itemStation = _pModel->itemFromIndex(iS);
|
||||||
|
itemStation->appendRow(pItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStandardItem* itemStation = new QStandardItem(sStation);
|
||||||
|
itemStation->appendRow(pItem);
|
||||||
|
itemZone->appendRow(itemStation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStandardItem* itemZone = new QStandardItem(sZone);
|
||||||
|
QStandardItem* itemStation = new QStandardItem(sStation);
|
||||||
|
itemStation->appendRow(pItem);
|
||||||
|
itemZone->appendRow(itemStation);
|
||||||
|
itemGrid->appendRow(itemZone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStandardItem* itemGrid = new QStandardItem(sGrid);
|
||||||
|
QStandardItem* itemZone = new QStandardItem(sZone);
|
||||||
|
QStandardItem* itemStation = new QStandardItem(sStation);
|
||||||
|
itemStation->appendRow(pItem);
|
||||||
|
itemZone->appendRow(itemStation);
|
||||||
|
itemGrid->appendRow(itemZone);
|
||||||
|
root->appendRow(itemGrid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,16 @@
|
||||||
<string>工程模</string>
|
<string>工程模</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuBay">
|
||||||
|
<property name="title">
|
||||||
|
<string>间隔管理</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuView"/>
|
<addaction name="menuView"/>
|
||||||
<addaction name="menuMode"/>
|
<addaction name="menuMode"/>
|
||||||
<addaction name="menuProject"/>
|
<addaction name="menuProject"/>
|
||||||
|
<addaction name="menuBay"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue