add measurement config
This commit is contained in:
parent
49991aa476
commit
056aede24b
|
|
@ -102,7 +102,10 @@ public:
|
|||
QString zone() const {return sZone;}
|
||||
void setStation(const QString& s) {sStation = s;}
|
||||
QString station() const {return sStation;}
|
||||
|
||||
void setSourceItemId(const QString& s) {sSourceItemId = s;}
|
||||
QString getSourceItemId() {return sSourceItemId;}
|
||||
void setMeasurement(QMap<QString,MeasurementInfo> map) {mMeasurement = map;}
|
||||
auto getMeasurement() {return mMeasurement;}
|
||||
protected:
|
||||
QString sPath;
|
||||
QString sDescription;
|
||||
|
|
@ -114,7 +117,8 @@ protected:
|
|||
int nStatus;
|
||||
QJsonObject jConnectedBus;
|
||||
QJsonObject jLabel;
|
||||
|
||||
QString sSourceItemId; //被哪个对象生成
|
||||
QMap<QString,MeasurementInfo> mMeasurement; //量测
|
||||
};
|
||||
|
||||
typedef QMap<QString,QVariant> VariableMap; //属性名,值
|
||||
|
|
|
|||
|
|
@ -338,6 +338,11 @@ struct propertyContentInfo //单个属性结构
|
|||
QWidget* proEditer = NULL; //编辑窗口对象
|
||||
};
|
||||
|
||||
struct measureAttributeType //量测可用属性类型(从基模获取的占位符变量)
|
||||
{
|
||||
QString tag;
|
||||
QString name;
|
||||
};
|
||||
//==================组态拓扑结构======================
|
||||
enum class DataState
|
||||
{
|
||||
|
|
@ -549,6 +554,16 @@ struct CtExtraInfo
|
|||
QString secondaryLoadCapacity; //二次负载容量
|
||||
};
|
||||
|
||||
struct MeasurementInfo //量测
|
||||
{
|
||||
QString tag; //量测tag
|
||||
QString name; //量测名称
|
||||
QString equipment; //设备名称
|
||||
QString channel; //设备端子
|
||||
QString type; //量测类型
|
||||
int size; //量测size
|
||||
};
|
||||
|
||||
//==================================================
|
||||
struct baseComponentInfo //基模图元数据
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
|||
include/baseContentDlg.h
|
||||
include/ptExtraInfoDlg.h
|
||||
include/ctExtraInfoDlg.h
|
||||
include/bayInfoDlg.h
|
||||
include/bayManagerDlg.h
|
||||
include/bayManagerContentDlg.h
|
||||
include/measureSettingDlg.h
|
||||
include/projectModelSetting.h
|
||||
include/projectDiagramNameInput.h
|
||||
include/diagramEditor/editPanel.h
|
||||
|
|
@ -83,6 +87,10 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
|||
source/baseContentDlg.cpp
|
||||
source/ptExtraInfoDlg.cpp
|
||||
source/ctExtraInfoDlg.cpp
|
||||
source/bayInfoDlg.cpp
|
||||
source/bayManagerDlg.cpp
|
||||
source/bayManagerContentDlg.cpp
|
||||
source/measureSettingDlg.cpp
|
||||
source/projectModelSetting.cpp
|
||||
source/projectDiagramNameInput.cpp
|
||||
source/diagramEditor/editPanel.cpp
|
||||
|
|
@ -137,6 +145,10 @@ set(UI_FILES
|
|||
ui/diagramEditorWizard.ui
|
||||
ui/projectModelSetting.ui
|
||||
ui/projectDiagramNameInput.ui
|
||||
ui/bayInfoDlg.ui
|
||||
ui/measureSettingDlg.ui
|
||||
ui/bayManagerDlg.ui
|
||||
ui/bayManagerContentDlg.ui
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
********************************************************/
|
||||
|
||||
class BaseProperty;
|
||||
class FixedPortsModel;
|
||||
|
||||
class BaseContentDlg : public QDialog
|
||||
{
|
||||
|
|
@ -23,9 +24,12 @@ public:
|
|||
//void setPropertyValue(QMap<QString,propertyStateInfo>);
|
||||
//void setPropertyValue(BaseProperty*);
|
||||
virtual void setPropertyValue(QVariant) = 0;
|
||||
void setModelController(FixedPortsModel* p){_curModelController = p;}
|
||||
auto getModelController() {return _curModelController;}
|
||||
protected:
|
||||
QMap<QString,propertyContentInfo> _mapPro;
|
||||
QFormLayout* createFormLayout(QWidget* parent);
|
||||
FixedPortsModel* _curModelController;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef BAYINFODLG_H
|
||||
#define BAYINFODLG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "baseContentDlg.h"
|
||||
#include "global.h"
|
||||
/*******************************************************
|
||||
间隔信息
|
||||
********************************************************/
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class bayInfoDlg; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MeasureSettingDlg;
|
||||
|
||||
class BayInfoDlg : public BaseContentDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BayInfoDlg(QWidget *parent = nullptr);
|
||||
virtual ~BayInfoDlg();
|
||||
virtual void createGroupView(groupStateInfo);
|
||||
virtual QMap<QString,propertyStateInfo> getPropertyValue(BaseProperty* = nullptr); //返回当前页面的属性值
|
||||
virtual void setPropertyValue(QVariant);
|
||||
auto& getValidType() {return _validType;} //获取可用的量测属性
|
||||
void setUi();
|
||||
void addMeasure(MeasurementInfo);
|
||||
public slots:
|
||||
void onAddClicked();
|
||||
void onDeleteClicked();
|
||||
void onIndexRbtnClicked(const QPoint &pos); //索引列表右键菜单
|
||||
private:
|
||||
void initial();
|
||||
private:
|
||||
Ui::bayInfoDlg *ui;
|
||||
MeasureSettingDlg* _measureDlg;
|
||||
QList<measureAttributeType> _validType; //可用的属性列表
|
||||
QMap<QString,MeasurementInfo> _mapMeasure; //量测列表
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef BAYMANAGERCONTENTDLG_H
|
||||
#define BAYMANAGERCONTENTDLG_H
|
||||
|
||||
#include <QDialog>
|
||||
/*******************************************************
|
||||
间隔内容
|
||||
********************************************************/
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class bayManagerContentDlg; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class BayManagerContentDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BayManagerContentDlg(QWidget *parent = nullptr);
|
||||
~BayManagerContentDlg();
|
||||
|
||||
void initial();
|
||||
void setName(const QString& s) {_sBayName = s;}
|
||||
QString name() {return _sBayName;}
|
||||
private:
|
||||
Ui::bayManagerContentDlg *ui;
|
||||
QString _sBayName; //每页的间隔名称
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef BAYMANAGERDLG_H
|
||||
#define BAYMANAGERDLG_H
|
||||
|
||||
#include <QDialog>
|
||||
/*******************************************************
|
||||
间隔管理
|
||||
********************************************************/
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class bayManagerDlg; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class BayManagerContentDlg;
|
||||
|
||||
class BayManagerDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BayManagerDlg(QWidget *parent = nullptr);
|
||||
~BayManagerDlg();
|
||||
|
||||
void initial();
|
||||
void showDlg();
|
||||
void clearData(); //切换打开文件时调用
|
||||
public slots:
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
private:
|
||||
void generatePage(QStringList); //生成间隔页 <间隔列表>
|
||||
private:
|
||||
Ui::bayManagerDlg *ui;
|
||||
QMap<int,BayManagerContentDlg*> _contentData; //<stack index,bay page>
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -40,7 +40,7 @@ public:
|
|||
void setPageName(QString s){_name = s;_pModel->setPageName(_name);} //设置当前page名称
|
||||
QString pageName(){return _name;}
|
||||
|
||||
FixedPortsModel* getModel() const {return _pModel;}
|
||||
FixedPortsModel* getModelController() const {return _pModel;}
|
||||
DiagramMode getMode(){return _mode;}
|
||||
|
||||
QJsonObject getDiagramInfo() const; //返回图元位置信息
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ public:
|
|||
QMap<QUuid,GraphicsProjectModelItem*>& allItems();
|
||||
bool addNodeItem(QUuid uuid,GraphicsProjectModelItem*);
|
||||
void addNodeItem(QUuid id,/*int type,*/QPointF pos);
|
||||
GraphicsProjectModelItem* nodeItem(QUuid uuid);
|
||||
QVariant nodeData(QUuid nodeId, NodeRole role) const;
|
||||
BaseProperty* addNodeData(QUuid id,int type,QString name,QString modelName); //对应component数据,一个data可对应多个item(id,类型,名称,工程模名)
|
||||
void loadNodeDataFromDataBase(); //从数据库加载数据
|
||||
|
|
@ -85,6 +86,7 @@ public Q_SLOTS:
|
|||
void onSignal_ifExits(QUuid id,const QString&,int type,GraphicsProjectModelItem*); //判断用户输入的名称是否已存在
|
||||
void onTimeOut();
|
||||
void onSignal_GetPointData(QString type,QMap<qint64,double> map);
|
||||
void onSignal_generateDiagram(const QString&); //生成工程组态信号
|
||||
private:
|
||||
|
||||
QMap<QUuid,GraphicsProjectModelItem*> _nodeItem; //工程模对象
|
||||
|
|
|
|||
|
|
@ -41,29 +41,11 @@ public:
|
|||
m_dWidth = m_dHeight = 0;
|
||||
m_pOperationCopy = nullptr;
|
||||
m_dSyncRotationByParent = 0.0;
|
||||
m_touched = false;
|
||||
}
|
||||
|
||||
virtual ~AbstractShapeType()
|
||||
{
|
||||
/*for (size_t i = 0; i < m_vecHanle.size(); i++)
|
||||
{
|
||||
ItemControlHandle* pHandle = m_vecHanle[i];
|
||||
if (pHandle)
|
||||
{
|
||||
delete pHandle;
|
||||
pHandle = nullptr;
|
||||
}
|
||||
}*/
|
||||
foreach (int key, m_vecHanle.keys())
|
||||
{
|
||||
ItemControlHandle* pHandle = m_vecHanle.value(key);
|
||||
if (pHandle)
|
||||
{
|
||||
delete pHandle;
|
||||
pHandle = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -93,15 +75,77 @@ public:
|
|||
updateCoordinate();
|
||||
}
|
||||
|
||||
//操作副本相关
|
||||
virtual void createOperationCopy() {}
|
||||
virtual void removeOperationCopy() {}
|
||||
virtual void moveOperationCopy(const QPointF&) {}
|
||||
virtual void rotateOperationCopy(const double&) {}
|
||||
|
||||
virtual void resize(int,double, double, const QPointF&) {}
|
||||
virtual void move(const QPointF&) {}
|
||||
virtual void editShape(int, const QPointF&) {}
|
||||
|
||||
virtual void updateCoordinate() {}
|
||||
|
||||
virtual QRectF boundingRect() const { return m_boundingRect; }
|
||||
virtual QPainterPath shape()
|
||||
{
|
||||
QPainterPath path;
|
||||
return path;
|
||||
}
|
||||
|
||||
virtual void syncRotationDataFromParent(const double&) {}
|
||||
virtual double getSyncRotationDataFromParent() {return m_dSyncRotationByParent;}
|
||||
protected:
|
||||
ShapeType m_type;
|
||||
QPen m_pen;
|
||||
QBrush m_brush;
|
||||
double m_dWidth;
|
||||
double m_dHeight;
|
||||
QRectF m_boundingRect;
|
||||
|
||||
double m_dSyncRotationByParent; //父项(被加入到某一组)的旋转数据,因为加入某一组后,对该组进行旋转,自身的旋转数据不会同步更新
|
||||
QGraphicsPathItem* m_pOperationCopy; //图元移动和旋转时的操作副本
|
||||
QPointF m_movingIniPos; //移动副本开始移动初始
|
||||
};
|
||||
|
||||
class ItemPort;
|
||||
class ModelProperty;
|
||||
class PowerEntity;
|
||||
|
||||
typedef AbstractShapeType<QGraphicsItem> AbstractShape;
|
||||
|
||||
class GraphicsBaseItem :public QObject, public AbstractShapeType<QGraphicsItem>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GraphicsBaseItem(QGraphicsItem *parent);
|
||||
virtual ~GraphicsBaseItem();
|
||||
public:
|
||||
virtual QUuid itemId() const {return m_itemId;}
|
||||
virtual void setItemId(QUuid n){m_itemId = n;}
|
||||
virtual int addPort(PortState typ,QPointF vec,QString id = "",HandleType hType = T_lineInOut,PortPos pos = P_top); //新建,返回-1失败
|
||||
virtual void setEntity(PowerEntity*); //设置当前图元的拓扑数据
|
||||
virtual PowerEntity* entity();
|
||||
virtual void setProperty(ModelProperty* p);
|
||||
virtual ModelProperty* getProperty() {return _property;}
|
||||
virtual void updateByProperty(){}; //使用data对象更新自己
|
||||
virtual void setItemChanged(bool b){_itemChanged = b;}
|
||||
virtual bool itemChanged() const {return _itemChanged;}
|
||||
virtual void setItemType(GraphicsItemType type){m_Itemtype = type;}
|
||||
virtual GraphicsItemType getItemType() const {return m_Itemtype;}
|
||||
virtual void renderSelectBackground(QPainter*);
|
||||
virtual ItemPort* getPortById(QString) const;
|
||||
virtual ItemPort* getPortPtr(int) const;
|
||||
virtual ItemControlHandle* getHandlePtr(int) const;
|
||||
virtual QMap<QString,ItemPort*> getPorts() {return m_mapPort;}
|
||||
//virtual GraphicsBaseItem*
|
||||
virtual void initialPortsByDatabase(); //从数据库初始化port信息
|
||||
virtual void setLastPoint(QPointF p) {m_lastPoint = p;}
|
||||
virtual void setTouched(bool b){m_touched = b;}
|
||||
|
||||
int collidesWithHandle(const QPointF& point)
|
||||
{
|
||||
/*for(auto it = m_vecHanle.begin(); it != m_vecHanle.end(); it++)
|
||||
{
|
||||
QPointF pt = (*it)->mapFromScene(point);
|
||||
if((*it)->contains(pt))
|
||||
return (*it)->getTag();
|
||||
}*/
|
||||
|
||||
foreach (int key, m_vecHanle.keys())
|
||||
{
|
||||
ItemControlHandle* pHandle = m_vecHanle.value(key);
|
||||
|
|
@ -118,32 +162,11 @@ public:
|
|||
return HandleTag::H_none;
|
||||
}
|
||||
|
||||
//操作副本相关
|
||||
virtual void createOperationCopy() {}
|
||||
virtual void removeOperationCopy() {}
|
||||
virtual void moveOperationCopy(const QPointF&) {}
|
||||
virtual void rotateOperationCopy(const double&) {}
|
||||
|
||||
virtual void resize(int,double, double, const QPointF&) {}
|
||||
virtual void move(const QPointF&) {}
|
||||
virtual void editShape(int, const QPointF&) {}
|
||||
|
||||
virtual void updateCoordinate() {}
|
||||
|
||||
//handle相关
|
||||
virtual int handleCount() { return m_vecHanle.count(); }
|
||||
virtual ItemControlHandle* getHandle(int nHandle)
|
||||
{
|
||||
ItemControlHandle* handle = nullptr;
|
||||
/*for(auto it = m_vecHanle.begin(); it != m_vecHanle.end(); it++)
|
||||
{
|
||||
if((*it)->getTag() == nHandle)
|
||||
{
|
||||
handle = (*it);
|
||||
return handle;
|
||||
}
|
||||
}*/
|
||||
|
||||
foreach (int key, m_vecHanle.keys())
|
||||
{
|
||||
ItemControlHandle* pHandle = m_vecHanle.value(key);
|
||||
|
|
@ -160,14 +183,6 @@ public:
|
|||
}
|
||||
virtual void setHandleVisible(bool bVisible)
|
||||
{
|
||||
/*for(auto it = m_vecHanle.begin(); it != m_vecHanle.end(); it++)
|
||||
{
|
||||
if(bVisible)
|
||||
(*it)->show();
|
||||
else
|
||||
(*it)->hide();
|
||||
}*/
|
||||
|
||||
foreach (int key, m_vecHanle.keys())
|
||||
{
|
||||
ItemControlHandle* pHandle = m_vecHanle.value(key);
|
||||
|
|
@ -404,70 +419,6 @@ public:
|
|||
double dParam = dWidth > dHeight ? (dDiagonal-dWidth*0.5):(dDiagonal-dHeight*0.5);
|
||||
m_boundingRect_selected = boundRect.adjusted(-dParam-nMargin, -dParam-nMargin, dParam+nMargin, dParam+nMargin);
|
||||
}
|
||||
|
||||
virtual QRectF boundingRect() const { return m_boundingRect; }
|
||||
virtual QPainterPath shape()
|
||||
{
|
||||
QPainterPath path;
|
||||
return path;
|
||||
}
|
||||
|
||||
virtual void syncRotationDataFromParent(const double&) {}
|
||||
virtual double getSyncRotationDataFromParent() {return m_dSyncRotationByParent;}
|
||||
virtual void setTouched(bool b){m_touched = b;}
|
||||
virtual void setLastPoint(QPointF p) {m_lastPoint = p;}
|
||||
protected:
|
||||
ShapeType m_type;
|
||||
QPen m_pen;
|
||||
QBrush m_brush;
|
||||
double m_dWidth;
|
||||
double m_dHeight;
|
||||
QRectF m_boundingRect;
|
||||
QRectF m_boundingRect_selected; //选中矩形框
|
||||
bool m_touched; //被触碰状态
|
||||
|
||||
double m_dSyncRotationByParent; //父项(被加入到某一组)的旋转数据,因为加入某一组后,对该组进行旋转,自身的旋转数据不会同步更新
|
||||
|
||||
QGraphicsPathItem* m_pOperationCopy; //图元移动和旋转时的操作副本
|
||||
QPointF m_movingIniPos; //移动副本开始移动初始
|
||||
QPointF m_lastPoint; //鼠标上次点击位置
|
||||
|
||||
QMap<int,ItemControlHandle*> m_vecHanle;
|
||||
};
|
||||
|
||||
class ItemPort;
|
||||
//class BaseProperty;
|
||||
class ModelProperty;
|
||||
class PowerEntity;
|
||||
|
||||
typedef AbstractShapeType<QGraphicsItem> AbstractShape;
|
||||
|
||||
class GraphicsBaseItem :public QObject, public AbstractShapeType<QGraphicsItem>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GraphicsBaseItem(QGraphicsItem *parent);
|
||||
virtual ~GraphicsBaseItem();
|
||||
public:
|
||||
virtual QUuid itemId() const {return m_itemId;}
|
||||
virtual void setItemId(QUuid n){m_itemId = n;}
|
||||
virtual int addPort(PortState typ,QPointF vec,QString id = "",HandleType hType = T_lineInOut,PortPos pos = P_top); //新建,返回-1失败
|
||||
virtual void setEntity(PowerEntity*); //设置当前图元的拓扑数据
|
||||
virtual PowerEntity* entity();
|
||||
virtual void setProperty(ModelProperty* p);
|
||||
virtual ModelProperty* getProperty() {return _property;}
|
||||
virtual void updateByProperty(){}; //使用data对象更新自己
|
||||
virtual void setItemChanged(bool b){_itemChanged = b;}
|
||||
virtual bool itemChanged() const {return _itemChanged;}
|
||||
virtual void setItemType(GraphicsItemType type){m_Itemtype = type;}
|
||||
virtual GraphicsItemType getItemType() const {return m_Itemtype;}
|
||||
virtual void renderSelectBackground(QPainter*);
|
||||
virtual ItemPort* getPortById(QString) const;
|
||||
virtual ItemPort* getPortPtr(int) const;
|
||||
virtual ItemControlHandle* getHandlePtr(int) const;
|
||||
virtual QMap<QString,ItemPort*> getPorts() {return m_mapPort;}
|
||||
//virtual GraphicsBaseItem*
|
||||
virtual void initialPortsByDatabase(); //从数据库初始化port信息
|
||||
public slots:
|
||||
void onUpdateData(); //data发送的更新通知
|
||||
protected:
|
||||
|
|
@ -477,6 +428,11 @@ protected:
|
|||
PowerEntity* _pEntity; //图元拓扑
|
||||
bool _itemChanged; //图元变化标志,判断是否需要保存
|
||||
QMap<QString,ItemPort*> m_mapPort; //单独存放port
|
||||
|
||||
QMap<int,ItemControlHandle*> m_vecHanle;
|
||||
QPointF m_lastPoint; //鼠标上次点击位置
|
||||
bool m_touched; //被触碰状态
|
||||
QRectF m_boundingRect_selected; //选中矩形框
|
||||
};
|
||||
|
||||
class GraphicsBaseModelItem : public GraphicsBaseItem //基模item
|
||||
|
|
@ -536,7 +492,6 @@ protected:
|
|||
QPointF m_endConnectPoint;
|
||||
int _lastPort; //最后触碰的port
|
||||
QString _modelName; //当前图元使用的模型名,用来在model中检索属性信息
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public:
|
|||
QString getId() {return _uuid;}
|
||||
void setName(const QString& str) {_name = str;}
|
||||
QString getName() const {return _name;}
|
||||
void setSourcePortId(const QString& id) {_sourcePortId = id;}
|
||||
QString getSourcePortId() {return _sourcePortId;}
|
||||
protected:
|
||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||
|
||||
|
|
@ -32,6 +34,7 @@ private:
|
|||
QString _name;
|
||||
PortPos _pos;
|
||||
ElectricConnectLineItem* _ptr;
|
||||
QString _sourcePortId; //被哪个port生成
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,18 +12,7 @@ namespace Ui { class itemPropertyDlg; }
|
|||
QT_END_NAMESPACE
|
||||
|
||||
class GraphicsProjectModelItem;
|
||||
|
||||
struct PropertyInfo
|
||||
{
|
||||
double resistance = 0; //电阻 DEFAULT 2,
|
||||
bool anchor_v = false; //是否锚定电压 DEFAULT FALSE,
|
||||
double uv_alarm = 0; //电压下限 DEFAULT 90,
|
||||
double ov_alarm = 0; //电压上限 DEFAULT 110,
|
||||
bool anchor_i = false; //是否锚定电流 DEFAULT FALSE,
|
||||
double ui_alarm = 0; //电流下限 DEFAULT 45,
|
||||
double oi_alarm = 0; //电流上限 DEFAULT 55,
|
||||
};
|
||||
Q_DECLARE_METATYPE(PropertyInfo);
|
||||
class FixedPortsModel;
|
||||
|
||||
class ItemPropertyDlg : public QDialog
|
||||
{
|
||||
|
|
@ -37,8 +26,8 @@ public:
|
|||
void loadGroupButton(QMap<QString,groupStateInfo>); //加载属性组列表
|
||||
void createGroupView(const QString&); //创建属性页
|
||||
void showDlg(modelDataInfo,QUuid,GraphicsProjectModelItem*); //显示属性页面
|
||||
signals:
|
||||
void PropertyChange(const PropertyInfo);
|
||||
void setModelController(FixedPortsModel* p) {_curModelController = p;}
|
||||
auto getModelController() {return _curModelController;}
|
||||
public slots:
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
|
|
@ -56,6 +45,7 @@ private:
|
|||
QUuid curUuid_; //当前显示对象的uuid
|
||||
QString _curModel; //当前模型名
|
||||
GraphicsProjectModelItem* _curItem;
|
||||
FixedPortsModel* _curModelController;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef MEASURESETTINGDLG_H
|
||||
#define MEASURESETTINGDLG_H
|
||||
|
||||
#include <QDialog>
|
||||
/*******************************************************
|
||||
间隔信息
|
||||
********************************************************/
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class measureSettingDlg; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class BayInfoDlg;
|
||||
|
||||
class MeasureSettingDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MeasureSettingDlg(QWidget *parent = nullptr);
|
||||
~MeasureSettingDlg();
|
||||
|
||||
void initial();
|
||||
void setBay(BayInfoDlg* p) {_pBay = p;}
|
||||
void showDlg();
|
||||
public slots:
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
void onTagChanged(const QString&);
|
||||
void onNameChanged(const QString&);
|
||||
private:
|
||||
void clearData();
|
||||
private:
|
||||
Ui::measureSettingDlg *ui;
|
||||
BayInfoDlg* _pBay;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -18,6 +18,8 @@ public:
|
|||
|
||||
void initial();
|
||||
void setModel(FixedPortsModel* p) {_model = p;}
|
||||
signals:
|
||||
void onGenerateClicked(const QString&);
|
||||
public slots:
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
BaseContentDlg::BaseContentDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
,_curModelController(nullptr)
|
||||
{
|
||||
setWindowFlags(Qt::Widget);
|
||||
//this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
ElectricBaseModelSvgBus::ElectricBaseModelSvgBus(const QRect &rect, QGraphicsItem *parent)
|
||||
: ElectricBaseModelSvgItem(rect,parent)
|
||||
{
|
||||
loadSvg(":/images/element/svg_bus.svg");
|
||||
//loadSvg(":/images/element/svg_bus.svg");
|
||||
setHandleIfShow(H_textCaption,false);
|
||||
setHandleVisible(false);
|
||||
setFunctionHandleIfShow(false);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,187 @@
|
|||
#include <QButtonGroup>
|
||||
#include <QJsonArray>
|
||||
#include <QMutableListIterator>
|
||||
#include <QMenu>
|
||||
#include "bayInfoDlg.h"
|
||||
#include "ui_bayInfoDlg.h"
|
||||
#include "baseProperty.h"
|
||||
#include "basePropertyManager.h"
|
||||
#include "measureSettingDlg.h"
|
||||
#include "dataBase.h"
|
||||
|
||||
BayInfoDlg::BayInfoDlg(QWidget *parent)
|
||||
: BaseContentDlg(parent)
|
||||
, ui(new Ui::bayInfoDlg)
|
||||
,_measureDlg(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
initial();
|
||||
}
|
||||
|
||||
BayInfoDlg::~BayInfoDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BayInfoDlg::initial()
|
||||
{
|
||||
setUi();
|
||||
connect(ui->btn_add,&QPushButton::clicked,this,&BayInfoDlg::onAddClicked);
|
||||
connect(ui->tableWidget_local, &QTableWidget::customContextMenuRequested, this, &BayInfoDlg::onIndexRbtnClicked);
|
||||
}
|
||||
|
||||
void BayInfoDlg::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> BayInfoDlg::getPropertyValue(BaseProperty* pPro)
|
||||
{
|
||||
QMap<QString,propertyStateInfo> map;
|
||||
|
||||
pPro->setMeasurement(_mapMeasure);
|
||||
return map;
|
||||
}
|
||||
|
||||
void BayInfoDlg::setPropertyValue(QVariant var)
|
||||
{
|
||||
BaseProperty* pPro = static_cast<BaseProperty*>(var.value<void*>());
|
||||
if(pPro)
|
||||
{
|
||||
QList<measureAttributeType> lstType = DataBase::GetInstance()->getMeasureAttributeTypes();
|
||||
auto map = pPro->getMeasurement();
|
||||
|
||||
/*QMutableListIterator<measureAttributeType> it(lstType);
|
||||
while(it.hasNext()){ //设置可用属性
|
||||
if(map.contains(it.next().name)){
|
||||
it.remove();
|
||||
}
|
||||
}*/
|
||||
_validType = lstType;
|
||||
|
||||
ui->tableWidget_local->clearContents(); //清空列表
|
||||
for(auto& info:map){
|
||||
addMeasure(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BayInfoDlg::setUi()
|
||||
{
|
||||
QStringList headerText;
|
||||
headerText<<"TAG"<<"名称"<<"设备"<<"端子"<<"类型"<<"SIZE";
|
||||
ui->tableWidget_local->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->tableWidget_local->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->tableWidget_local->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->tableWidget_local->setColumnCount(headerText.count());
|
||||
ui->tableWidget_local->setHorizontalHeaderLabels(headerText);
|
||||
ui->tableWidget_local->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableWidget_local->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
ui->tableWidget_local->setStyleSheet(
|
||||
"QTableWidget::item {"
|
||||
" padding: 5px;" // 可选:增加内边距
|
||||
" white-space: pre-wrap;" // 关键:保留空白符并允许自动换行
|
||||
"}"
|
||||
);
|
||||
}
|
||||
|
||||
void BayInfoDlg::addMeasure(MeasurementInfo info)
|
||||
{
|
||||
if(_mapMeasure.contains(info.name))
|
||||
return;
|
||||
int row = ui->tableWidget_local->rowCount();
|
||||
ui->tableWidget_local->insertRow(row);
|
||||
|
||||
QTableWidgetItem* tagItem = new QTableWidgetItem(info.tag);
|
||||
ui->tableWidget_local->setItem(row, 0, tagItem);
|
||||
|
||||
QTableWidgetItem* nameItem = new QTableWidgetItem(info.name);
|
||||
ui->tableWidget_local->setItem(row, 1, nameItem);
|
||||
|
||||
QTableWidgetItem* deviceItem = new QTableWidgetItem(info.equipment);
|
||||
ui->tableWidget_local->setItem(row, 2, deviceItem);
|
||||
|
||||
QTableWidgetItem* channelItem = new QTableWidgetItem(info.channel);
|
||||
ui->tableWidget_local->setItem(row, 3, channelItem);
|
||||
|
||||
QTableWidgetItem* typeItem = new QTableWidgetItem(info.type);
|
||||
ui->tableWidget_local->setItem(row, 4, typeItem);
|
||||
|
||||
QTableWidgetItem* sizeItem = new QTableWidgetItem(QString::number(info.size));
|
||||
ui->tableWidget_local->setItem(row, 5, sizeItem);
|
||||
|
||||
_mapMeasure.insert(info.name,info);
|
||||
for(int i = 0;i < _validType.size();++i){
|
||||
if(_validType.at(i).name == info.name){ //可用类型中移除该类型
|
||||
_validType.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BayInfoDlg::onAddClicked()
|
||||
{
|
||||
if(_measureDlg == nullptr){
|
||||
_measureDlg = new MeasureSettingDlg(this);
|
||||
_measureDlg->setBay(this);
|
||||
}
|
||||
_measureDlg->showDlg();
|
||||
}
|
||||
|
||||
void BayInfoDlg::onDeleteClicked()
|
||||
{
|
||||
// 获取当前选中的索引
|
||||
QModelIndexList selectedIndexes = ui->tableWidget_local->selectionModel()->selectedRows();
|
||||
if (selectedIndexes.isEmpty()) {
|
||||
return; // 没有选中任何行
|
||||
}
|
||||
|
||||
// 获取当前选中的第一项索引
|
||||
QModelIndex index = selectedIndexes.first();
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex indexName = index.sibling(index.row(),1);
|
||||
QString sName = indexName.data().toString();
|
||||
if(_mapMeasure.contains(sName)){
|
||||
MeasurementInfo info = _mapMeasure.take(sName);
|
||||
measureAttributeType typ;
|
||||
typ.name = info.name;
|
||||
typ.tag = info.tag;
|
||||
_validType.append(typ);
|
||||
}
|
||||
|
||||
int currentRow = ui->tableWidget_local->currentRow();
|
||||
if (currentRow == -1) {
|
||||
return; // 没有选中行
|
||||
}
|
||||
|
||||
ui->tableWidget_local->removeRow(currentRow);
|
||||
}
|
||||
|
||||
void BayInfoDlg::onIndexRbtnClicked(const QPoint &pos)
|
||||
{
|
||||
// 获取当前点击的位置对应的索引
|
||||
QModelIndex index = ui->tableWidget_local->indexAt(pos);
|
||||
if (!index.isValid()) {
|
||||
return; // 如果点击的是空白区域,直接返回
|
||||
}
|
||||
|
||||
QMenu menu;
|
||||
QAction *deleteAction = new QAction("移除量测", this);
|
||||
menu.addAction(deleteAction);
|
||||
|
||||
// 连接删除菜单项的触发信号与槽函数
|
||||
connect(deleteAction, &QAction::triggered, this, &BayInfoDlg::onDeleteClicked);
|
||||
|
||||
// 在点击位置显示菜单
|
||||
menu.exec(ui->tableWidget_local->mapToGlobal(pos));
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#include "bayManagerContentDlg.h"
|
||||
#include "ui_bayManagerContentDlg.h"
|
||||
|
||||
BayManagerContentDlg::BayManagerContentDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::bayManagerContentDlg)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
initial();
|
||||
}
|
||||
|
||||
BayManagerContentDlg::~BayManagerContentDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BayManagerContentDlg::initial()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#include "bayManagerDlg.h"
|
||||
#include "bayManagerContentDlg.h"
|
||||
#include "ui_bayManagerDlg.h"
|
||||
|
||||
BayManagerDlg::BayManagerDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::bayManagerDlg)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
initial();
|
||||
}
|
||||
|
||||
BayManagerDlg::~BayManagerDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BayManagerDlg::initial()
|
||||
{
|
||||
connect(ui->btn_ok,&QPushButton::clicked,this,&BayManagerDlg::onOkClicked);
|
||||
connect(ui->btn_cancel,&QPushButton::clicked,this,&BayManagerDlg::onCancelClicked);
|
||||
}
|
||||
|
||||
void BayManagerDlg::showDlg()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BayManagerDlg::clearData()
|
||||
{
|
||||
ui->listWidget->clear();
|
||||
for(auto& page:_contentData)
|
||||
{
|
||||
ui->stackedWidget->removeWidget(page);
|
||||
}
|
||||
qDeleteAll(_contentData);
|
||||
_contentData.clear();
|
||||
}
|
||||
|
||||
void BayManagerDlg::onOkClicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void BayManagerDlg::onCancelClicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void BayManagerDlg::generatePage(QStringList lstBay)
|
||||
{
|
||||
ui->listWidget->addItems(lstBay);
|
||||
for(auto& str:lstBay)
|
||||
{
|
||||
BayManagerContentDlg* pBay = new BayManagerContentDlg(this);
|
||||
pBay->setName(str);
|
||||
int index = ui->stackedWidget->addWidget(pBay);
|
||||
_contentData.insert(index,pBay);
|
||||
}
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ void DiagramCavas::onSignal_addDrawingPanel(PowerEntity* pItem,DiagramMode mode)
|
|||
m_mapDrawPanel.insert(_curPage,qMakePair(pPanel,pSub));
|
||||
pPanel->show();
|
||||
|
||||
FixedPortsModel* pModel = pPanel->getModel();
|
||||
FixedPortsModel* pModel = pPanel->getModelController();
|
||||
pModel->setCavas(this);
|
||||
connect(pModel,&FixedPortsModel::activatePage,this,&DiagramCavas::onSignal_activatePage);
|
||||
connect(pPanel,&DrawingPanel::panelDelete,this,&DiagramCavas::onSignal_panelDelete);
|
||||
|
|
@ -106,7 +106,7 @@ void DiagramCavas::onSignal_savePage()
|
|||
switch (ret) {
|
||||
case QMessageBox::Save: //todo:已存在更新
|
||||
{
|
||||
QMap<QUuid,GraphicsProjectModelItem*> map = pPanel->getModel()->allItems();
|
||||
QMap<QUuid,GraphicsProjectModelItem*> map = pPanel->getModelController()->allItems();
|
||||
for(auto pItem:map)
|
||||
{
|
||||
if(pItem->itemChanged())
|
||||
|
|
@ -345,7 +345,7 @@ void DiagramCavas::onCreateTestBaseModelDiagram()
|
|||
|
||||
onSignal_addDrawingPanel(pEntity,DM_baseModel);
|
||||
DrawingPanel* pPanel = getPanel(pEntity->name());
|
||||
pPanel->getModel()->addTestData();
|
||||
pPanel->getModelController()->addTestData();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ void DrawingPanel::onSignal_Generate()
|
|||
if(m_pDiagramNameInputer == nullptr){
|
||||
m_pDiagramNameInputer = new ProjectDiagramNameInput(this);
|
||||
m_pDiagramNameInputer->setModel(_pModel);
|
||||
connect(m_pDiagramNameInputer,&ProjectDiagramNameInput::onGenerateClicked,_pModel,&FixedPortsModel::onSignal_generateDiagram);
|
||||
}
|
||||
m_pDiagramNameInputer->show();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,11 @@ QMap<QUuid,GraphicsProjectModelItem*>& FixedPortsModel::allItems()
|
|||
return _nodeItem;
|
||||
}
|
||||
|
||||
GraphicsProjectModelItem* FixedPortsModel::nodeItem(QUuid uuid)
|
||||
{
|
||||
return _nodeItem.value(uuid,nullptr);
|
||||
}
|
||||
|
||||
bool FixedPortsModel::addNodeItem(QUuid uuid,GraphicsProjectModelItem* pItem)
|
||||
{
|
||||
|
||||
|
|
@ -575,6 +580,31 @@ void FixedPortsModel::onSignal_GetPointData(QString type,QMap<qint64,double> map
|
|||
}
|
||||
}
|
||||
|
||||
void FixedPortsModel::onSignal_generateDiagram(const QString& sName)
|
||||
{
|
||||
QStringList lstInfo;
|
||||
for(auto& item:_baseItem){
|
||||
BaseModelProperty* pBase = dynamic_cast<BaseModelProperty*>(item->getProperty());
|
||||
if(pBase){
|
||||
QString sModel = pBase->getModelProperty().modelSetting.modelName;
|
||||
if(sModel.isEmpty()){
|
||||
lstInfo.append(pBase->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!lstInfo.isEmpty()){
|
||||
QMessageBox::information(NULL, QString("提示"), QString::fromWCharArray(L"%1未设置完毕").arg(lstInfo.join("、")));
|
||||
return;
|
||||
}
|
||||
|
||||
QList<GraphicsBaseModelItem*> lst;
|
||||
for(auto& item:_baseItem)
|
||||
{
|
||||
lst.append(item);
|
||||
}
|
||||
generateProjectModel(sName,lst);
|
||||
}
|
||||
|
||||
void FixedPortsModel::startHttpRequest()
|
||||
{
|
||||
if(_timer)
|
||||
|
|
@ -747,6 +777,7 @@ void FixedPortsModel::generatePropertyDlg(const QString& sModel)
|
|||
ItemPropertyDlg* dlg = new ItemPropertyDlg(_widget);
|
||||
if(dlg)
|
||||
{
|
||||
dlg->setModelController(this);
|
||||
dlg->loadGroupButton(info.groupInfo);
|
||||
_modelStateInfo[sModel]._PropertyDlg = dlg;
|
||||
}
|
||||
|
|
@ -920,7 +951,7 @@ void FixedPortsModel::generateProjectModel(const QString& sPageName,QList<Graphi
|
|||
pProPanel = _cavas->getPanel(sPageName);
|
||||
}
|
||||
|
||||
for(auto& pBaseItem:lstItem) //首次循环处理所有非连线对象
|
||||
/*for(auto& pBaseItem:lstItem) //首次循环处理所有非连线对象
|
||||
{
|
||||
BaseModelProperty* pBase = dynamic_cast<BaseModelProperty*>(pBaseItem->getProperty());
|
||||
if(pBase->type() != 8){ //不是电缆
|
||||
|
|
@ -932,18 +963,18 @@ void FixedPortsModel::generateProjectModel(const QString& sPageName,QList<Graphi
|
|||
addProjectItemByBaseData(pProPanel,pBaseItem,pData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
for(auto& pBaseItem:lstItem) //第二次循环处理所有连线对象
|
||||
{
|
||||
BaseModelProperty* pBase = dynamic_cast<BaseModelProperty*>(pBaseItem->getProperty());
|
||||
if(pBase->type() == 8){ //电缆
|
||||
QUuid id = QUuid::createUuid();
|
||||
BaseProperty* pData = pProPanel->getModel()->addNodeData(id,pBase->type(),pBase->name(),pBase->modelName());
|
||||
BaseProperty* pData = pProPanel->getModelController()->addNodeData(id,pBase->type(),pBase->name(),pBase->modelName());
|
||||
if(pData)
|
||||
{
|
||||
pData->setDataChanged(true); //数据状态改变
|
||||
//addProjectItemByBaseData(pProPanel,pBaseItem,pData);
|
||||
addProjectItemByBaseData(pProPanel,pBaseItem,pData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -956,27 +987,47 @@ void FixedPortsModel::addProjectItemByBaseData(DrawingPanel* pPanel,GraphicsBase
|
|||
if(_baseItem.contains(pBase->uuid())){
|
||||
GraphicsProjectModelItem* pProItem = nullptr;
|
||||
GraphicsBaseModelItem* pBaseItem = _baseItem.value(pBase->uuid());
|
||||
pPro->setSourceItemId(pBaseItem->itemId().toString()); //设置被哪个对象生成
|
||||
int type = pBase->graphicsType();
|
||||
if(type == GIT_baseBus)
|
||||
{
|
||||
QByteArray svg;
|
||||
if(pBase->getModelProperty().modelSetting.mapSvg.isEmpty()){
|
||||
svg = DataBase::GetInstance()->ModelType()[1].icon;
|
||||
}
|
||||
else{
|
||||
svg = pBase->getModelProperty().modelSetting.mapSvg.first();
|
||||
}
|
||||
QRectF rec = pBaseItem->boundingRect();
|
||||
pProItem = new ElectricSvgItemBus(rec.toRect());
|
||||
auto pBus = new ElectricSvgItemRect(rec.toRect());
|
||||
pBus->loadSvg(svg);
|
||||
pProItem = pBus;
|
||||
pProItem->setItemType(GIT_bus);
|
||||
QByteArray svg = pBase->getModelProperty().modelSetting.mapSvg.first();
|
||||
}
|
||||
else if(type == GIT_baseBreaker)
|
||||
{
|
||||
QByteArray svg;
|
||||
if(pBase->getModelProperty().modelSetting.mapSvg.isEmpty()){
|
||||
svg = DataBase::GetInstance()->ModelType()[3].icon;
|
||||
}
|
||||
else{
|
||||
svg = pBase->getModelProperty().modelSetting.mapSvg.first();
|
||||
}
|
||||
QRectF rec = pBaseItem->boundingRect();
|
||||
pProItem = new ElectricSvgItemRect(rec.toRect());
|
||||
auto pBreaker = new ElectricSvgItemRect(rec.toRect());
|
||||
pBreaker->loadSvg(svg);
|
||||
pProItem = pBreaker;
|
||||
pProItem->setItemType(GIT_itemRect);
|
||||
QByteArray svg = pBase->getModelProperty().modelSetting.mapSvg.first();
|
||||
}
|
||||
|
||||
if(pBase->graphicsType() == GIT_baseLine)
|
||||
else if(type == GIT_baseLine)
|
||||
{
|
||||
|
||||
pProItem = new ElectricConnectLineItem();
|
||||
pProItem->setItemId(pPro->uuid());
|
||||
pProItem->setItemType(GIT_link);
|
||||
pPanel->getScene()->addItem(pProItem);
|
||||
}
|
||||
else
|
||||
|
||||
if(pBase->graphicsType() != GIT_baseLine) //非连接线对象
|
||||
{
|
||||
PowerEntity* pEntity = TopologyManager::instance().createEntity(EntityType::Component,pPro->uuid().toString(),pBase->name());
|
||||
QList<PowerTerminal*> lstBase = TopologyManager::instance().getTerminalsForEntity(pBase->uuid().toString(),ModelFunctionType::BaseModel); //获取基模的逻辑点
|
||||
|
|
@ -988,6 +1039,8 @@ void FixedPortsModel::addProjectItemByBaseData(DrawingPanel* pPanel,GraphicsBase
|
|||
if(proTer->type() == TerminalType::PowerConnect)
|
||||
{
|
||||
pProItem->addPort(p_movable,proTer->relativePosition(),proTer->id());
|
||||
ItemPort* pPort = pProItem->getPortById(proTer->id());
|
||||
pPort->setSourcePortId(baseTer->id());
|
||||
}
|
||||
else if(proTer->type() == TerminalType::PowerInput || proTer->type() == TerminalType::PowerOutput)
|
||||
{
|
||||
|
|
@ -1010,13 +1063,16 @@ void FixedPortsModel::addProjectItemByBaseData(DrawingPanel* pPanel,GraphicsBase
|
|||
}
|
||||
else if(pos.y() > 0)
|
||||
{
|
||||
locate = P_top;
|
||||
locate = P_down;
|
||||
}
|
||||
else if(pos.y() < 0)
|
||||
{
|
||||
locate = P_down;
|
||||
locate = P_top;
|
||||
}
|
||||
pProItem->addPort(P_const,pos,proTer->id(),typ,locate);
|
||||
|
||||
ItemPort* pPort = pProItem->getPortById(proTer->id());
|
||||
pPort->setSourcePortId(baseTer->id());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1027,10 +1083,94 @@ void FixedPortsModel::addProjectItemByBaseData(DrawingPanel* pPanel,GraphicsBase
|
|||
pProItem->setProperty(pPro); //绑定模型
|
||||
pProItem->updateByProperty(); //使用模型更新自身
|
||||
//QString sModel = _projectModelName.value(id.toString());
|
||||
QString sModel = pBase->getModelProperty().modelSetting.modelName;
|
||||
pProItem->setModelName(sModel);
|
||||
pPanel->getModel()->addNodeItem(QUuid(pEntity->id()),pProItem);
|
||||
//QString sModel = pBase->getModelProperty().modelSetting.modelName;
|
||||
//pProItem->setModelName(sModel);
|
||||
pPanel->getModelController()->addNodeItem(QUuid(pEntity->id()),pProItem);
|
||||
}
|
||||
else //连接线对象
|
||||
{
|
||||
PowerConnection* pCon = TopologyManager::instance().connection(pBase->uuid().toString(),ModelFunctionType::BaseModel);
|
||||
if(pCon){
|
||||
//基模connect参数
|
||||
QString baseFromComponentId = pCon->fromComponent();
|
||||
QString baseToComponentId = pCon->toComponent();
|
||||
QString baseFromTerId = pCon->fromTerminalId();
|
||||
QString baseToTerId = pCon->toTerminalId();
|
||||
|
||||
QMap<QUuid,BaseProperty*> mapPro = BasePropertyManager::instance().getEntityData();
|
||||
bool proFromExist = false; //工程模from对象是否生成
|
||||
bool proToExist = false; //工程模to对象是否生成
|
||||
|
||||
QString proFromItemId;
|
||||
QString proToItemId;
|
||||
QString proFromTerId;
|
||||
QString proToTerId;
|
||||
for(auto& pPro:mapPro)
|
||||
{
|
||||
if(pPro->getSourceItemId() == baseFromComponentId){
|
||||
proFromExist = true;
|
||||
proFromItemId = pPro->uuid().toString();
|
||||
continue;
|
||||
}
|
||||
if(pPro->getSourceItemId() == baseToComponentId){
|
||||
proToExist = true;
|
||||
proToItemId = pPro->uuid().toString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!proFromExist) //工程模from对象未生成
|
||||
{
|
||||
GraphicsBaseModelItem* pFromItem = _baseItem.value(QUuid(baseFromComponentId));
|
||||
QUuid id = QUuid::createUuid();
|
||||
BaseProperty* pData = pPanel->getModelController()->addNodeData(id,pFromItem->getProperty()->type(),pFromItem->getProperty()->name(),pFromItem->getProperty()->modelName());
|
||||
addProjectItemByBaseData(pPanel,pFromItem,pData);
|
||||
proFromItemId = id.toString();
|
||||
}
|
||||
|
||||
if(!proToExist) //工程模to对象未生成
|
||||
{
|
||||
GraphicsBaseModelItem* pToItem = _baseItem.value(QUuid(baseToComponentId));
|
||||
QUuid id = QUuid::createUuid();
|
||||
BaseProperty* pData = pPanel->getModelController()->addNodeData(id,pToItem->getProperty()->type(),pToItem->getProperty()->name(),pToItem->getProperty()->modelName());
|
||||
addProjectItemByBaseData(pPanel,pToItem,pData);
|
||||
proToItemId = id.toString();
|
||||
}
|
||||
|
||||
GraphicsProjectModelItem* proFrom = pPanel->getModelController()->nodeItem(QUuid(proFromItemId));
|
||||
GraphicsProjectModelItem* proTo = pPanel->getModelController()->nodeItem(QUuid(proToItemId));
|
||||
if(proFrom){
|
||||
QMap<QString,ItemPort*> mapFrom = proFrom->getPorts();
|
||||
for(auto& port:mapFrom){
|
||||
if(port->getSourcePortId() == baseFromTerId){
|
||||
proFromTerId = port->getId();
|
||||
auto pLine = dynamic_cast<ElectricConnectLineItem*>(pProItem);
|
||||
if(pLine)
|
||||
pLine->setStartPoint(port->scenePos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(proTo){
|
||||
QMap<QString,ItemPort*> mapTo = proTo->getPorts();
|
||||
for(auto& port:mapTo){
|
||||
if(port->getSourcePortId() == baseToTerId){
|
||||
proToTerId = port->getId();
|
||||
auto pLine = dynamic_cast<ElectricConnectLineItem*>(pProItem);
|
||||
if(pLine)
|
||||
pLine->setEndPoint(port->scenePos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PowerConnection* pCon = TopologyManager::instance().createConnection(pPro->uuid().toString(),proFromTerId,proToTerId,proFromItemId,proToItemId);
|
||||
auto pLine = dynamic_cast<ElectricConnectLineItem*>(pProItem);
|
||||
if(pLine)
|
||||
pLine->calculatePath();
|
||||
}
|
||||
}
|
||||
QString sModel = pBase->getModelProperty().modelSetting.modelName;
|
||||
pProItem->setModelName(sModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1047,6 +1187,7 @@ void FixedPortsModel::addTestData()
|
|||
if(pEntityBreaker)
|
||||
pBreaker->setEntity(pEntityBreaker);
|
||||
BaseModelProperty* pBreakerData = addBaseNodeData(breakerId,3,"断路器1",DataBase::GetInstance()->ModelType()[3].modelType);
|
||||
pBreakerData->setGraphicsType(GIT_baseBreaker);
|
||||
if(pBreakerData)
|
||||
{
|
||||
pBreaker->setProperty(pBreakerData);
|
||||
|
|
@ -1068,12 +1209,13 @@ void FixedPortsModel::addTestData()
|
|||
pBus->loadSvg(byte1);
|
||||
//createTopoTerminalsByItem(pBreaker);
|
||||
BaseModelProperty* pBusData = addBaseNodeData(busId,1,"母线1",DataBase::GetInstance()->ModelType()[1].modelType);
|
||||
pBusData->setGraphicsType(GIT_baseBus);
|
||||
if(pBusData)
|
||||
{
|
||||
pBus->setProperty(pBusData);
|
||||
pBusData->setDataChanged(true); //数据状态改变
|
||||
}
|
||||
PowerEntity* pEntityBus = TopologyManager::instance().createEntity(EntityType::Component,breakerId.toString(),"母线1",ModelFunctionType::BaseModel);
|
||||
PowerEntity* pEntityBus = TopologyManager::instance().createEntity(EntityType::Component,busId.toString(),"母线1",ModelFunctionType::BaseModel);
|
||||
if(pEntityBus)
|
||||
pBus->setEntity(pEntityBus);
|
||||
addBaseItem(busId,pBus);
|
||||
|
|
@ -1085,6 +1227,7 @@ void FixedPortsModel::addTestData()
|
|||
pLine->setItemId(lineId);
|
||||
pLine->setItemType(GIT_baseLine);
|
||||
BaseModelProperty* pLineData = addBaseNodeData(lineId,8,"电缆1",DataBase::GetInstance()->ModelType()[4].modelType);
|
||||
pLineData->setGraphicsType(GIT_baseLine);
|
||||
if(pLineData)
|
||||
{
|
||||
pLine->setProperty(pLineData);
|
||||
|
|
|
|||
|
|
@ -18,33 +18,13 @@ ElectricSvgItemRect::ElectricSvgItemRect(const QRect &rect, bool genNewPort, QGr
|
|||
setFunctionHandleIfShow(false);
|
||||
setFunctionHandleEnaable(false);
|
||||
|
||||
//入线口
|
||||
/*ItemPort* pHandle1 = new ItemPort(this);
|
||||
pHandle1->setType(T_lineIn);
|
||||
pHandle1->setTag(H_connect);
|
||||
pHandle1->setPortPos(P_top);
|
||||
pHandle1->setParent(this);
|
||||
m_vecHanle.insert(H_connect,pHandle1);
|
||||
//出线口
|
||||
ItemPort* pHandle2 = new ItemPort(this);
|
||||
pHandle2->setType(T_lineOut);
|
||||
pHandle2->setTag(H_connect+1);
|
||||
pHandle2->setPortPos(P_down);
|
||||
pHandle2->setParent(this);
|
||||
m_vecHanle.insert(H_connect+1,pHandle2);
|
||||
|
||||
m_mapPort.insert(QString::number(_portId++),pHandle1);
|
||||
m_mapPort.insert(QString::number(_portId++),pHandle2);*/
|
||||
|
||||
m_dRatioX = 0.5;
|
||||
|
||||
if(genNewPort)
|
||||
/*if(genNewPort)
|
||||
{
|
||||
addPort(P_const,QPointF(boundingRect().right() - boundingRect().width() * m_dRatioX, boundingRect().top()),QUuid::createUuid().toString(),T_lineIn,P_top);
|
||||
addPort(P_const,QPointF(boundingRect().right() - boundingRect().width() * m_dRatioX, boundingRect().bottom()),QUuid::createUuid().toString(),T_lineOut,P_down);
|
||||
}
|
||||
|
||||
qRegisterMetaType<PropertyInfo>("PropertyInfo"); //注册自定义数据类型
|
||||
}*/
|
||||
}
|
||||
|
||||
ElectricSvgItemRect::~ElectricSvgItemRect()
|
||||
|
|
@ -56,20 +36,6 @@ ElectricSvgItemRect::~ElectricSvgItemRect()
|
|||
void ElectricSvgItemRect::updateHandles()
|
||||
{
|
||||
ElectricSvgItem::updateHandles();
|
||||
/*if( m_vecHanle.contains(H_connect))
|
||||
{
|
||||
const QRectF& boundingRect = this->boundingRect();
|
||||
|
||||
if(m_vecHanle.contains(H_connect))
|
||||
{
|
||||
m_vecHanle[H_connect]->move(boundingRect.right() - boundingRect.width() * m_dRatioX, boundingRect.top());
|
||||
}
|
||||
|
||||
if(m_vecHanle.contains(H_connect + 1))
|
||||
{
|
||||
m_vecHanle[H_connect + 1]->move(boundingRect.right() - boundingRect.width() * m_dRatioX, boundingRect.bottom());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void ElectricSvgItemRect::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||
|
|
@ -78,7 +44,3 @@ void ElectricSvgItemRect::paint(QPainter* painter, const QStyleOptionGraphicsIte
|
|||
}
|
||||
|
||||
|
||||
/*void ElectricSvgItemRect::updateByProperty()
|
||||
{
|
||||
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ GraphicsBaseItem::GraphicsBaseItem(QGraphicsItem *parent)
|
|||
{
|
||||
m_type = T_item;
|
||||
_itemChanged = false;
|
||||
m_touched = false;
|
||||
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
|
|
@ -24,7 +25,15 @@ GraphicsBaseItem::GraphicsBaseItem(QGraphicsItem *parent)
|
|||
|
||||
GraphicsBaseItem::~GraphicsBaseItem()
|
||||
{
|
||||
|
||||
foreach (int key, m_vecHanle.keys())
|
||||
{
|
||||
ItemControlHandle* pHandle = m_vecHanle.value(key);
|
||||
if (pHandle)
|
||||
{
|
||||
delete pHandle;
|
||||
pHandle = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int GraphicsBaseItem::addPort(PortState typ,QPointF vec,QString id,HandleType hType,PortPos pos)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "graphicsItem/graphicsItemGroup.h"
|
||||
#include "graphicsItem/handleRect.h"
|
||||
//#include "graphicsItem/handleRect.h"
|
||||
#include <QGraphicsScene>
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
|
|
@ -16,7 +16,7 @@ GraphicsItemGroup::GraphicsItemGroup(QGraphicsItem *parent)
|
|||
|
||||
//初始化缩放操作用的handle
|
||||
//m_vecHanle.reserve(H_left);
|
||||
for(int i = H_leftTop; i <= H_left; i++)
|
||||
/*for(int i = H_leftTop; i <= H_left; i++)
|
||||
{
|
||||
ItemControlHandle* pHandle = new HandleRect(this);
|
||||
pHandle->setType(T_resize);
|
||||
|
|
@ -29,7 +29,7 @@ GraphicsItemGroup::GraphicsItemGroup(QGraphicsItem *parent)
|
|||
pHandle->setType(T_rotate);
|
||||
pHandle->setTag(i);
|
||||
m_vecHanle.insert(i-1,pHandle);
|
||||
}
|
||||
}*/
|
||||
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
|
|
@ -55,15 +55,8 @@ void GraphicsItemGroup::paint(QPainter* painter, const QStyleOptionGraphicsItem*
|
|||
int nPenWidth = 1;
|
||||
painter->setPen(QPen(QColor(70,70,70), nPenWidth, Qt::DashLine)); //蓝色的外框
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawRect(m_boundingRect_selected);
|
||||
painter->drawRect(m_boundingRect);
|
||||
|
||||
//绘制变换原点
|
||||
/*QPointF originPoint = transformOriginPoint();
|
||||
//qDebug() << "originPoint:" << originPoint << " boundingRect:" << m_boundingRect;
|
||||
painter->setBrush(Qt::red);
|
||||
painter->drawEllipse(QPointF(0,0), 4, 4);
|
||||
painter->setBrush(Qt::blue);
|
||||
painter->drawEllipse(originPoint, 4, 4);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,9 +70,7 @@ QVariant GraphicsItemGroup::itemChange(QGraphicsItem::GraphicsItemChange change,
|
|||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
QGraphicsItemGroup *group = dynamic_cast<QGraphicsItemGroup *>(parentItem());
|
||||
if(!group)
|
||||
setHandleVisible(value.toBool());
|
||||
else //在某一组群中,由组群展示是否选中,自身不做展示
|
||||
if(group) //在某一组群中,由组群展示是否选中,自身不做展示
|
||||
{
|
||||
setSelected(false);
|
||||
return QVariant::fromValue<bool>(false);
|
||||
|
|
@ -147,7 +138,7 @@ void GraphicsItemGroup::updateCoordinate() //当执行了resie和editShape函数
|
|||
|
||||
//QTimer::singleShot(2000,[&](){moveBy(-delta.x(), -delta.y());});
|
||||
|
||||
updateHandles();
|
||||
//updateHandles();
|
||||
}
|
||||
|
||||
//调用该组内所有item(过滤handle)相关函数
|
||||
|
|
@ -188,7 +179,7 @@ void GraphicsItemGroup::resize(int nHandle,double dSX, double dSY, const QPointF
|
|||
m_boundingRect = trans.mapRect(m_lastBoudingRect);
|
||||
m_dWidth = m_boundingRect.width();
|
||||
m_dHeight = m_boundingRect.height();
|
||||
updateHandles();
|
||||
//updateHandles();
|
||||
|
||||
//调用该组内所有item(过滤handle)相关函数
|
||||
foreach (QGraphicsItem *item, childItems())
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "baseProperty.h"
|
||||
#include "ptExtraInfoDlg.h"
|
||||
#include "ctExtraInfoDlg.h"
|
||||
#include "bayInfoDlg.h"
|
||||
|
||||
ItemPropertyDlg::ItemPropertyDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
|
|
@ -18,6 +19,7 @@ ItemPropertyDlg::ItemPropertyDlg(QWidget *parent)
|
|||
,layout_(nullptr)
|
||||
,btnGroup_(nullptr)
|
||||
,_curItem(nullptr)
|
||||
,_curModelController(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
|
|
@ -103,7 +105,7 @@ void ItemPropertyDlg::onGroupSelected(const QString& str)
|
|||
{
|
||||
QMap<QString,propertyStateInfo> valueMap;
|
||||
BaseProperty* pPro = BasePropertyManager::instance().findEntityData(curUuid_);
|
||||
if(str != QString("component") && str != QString("基本信息"))
|
||||
if(str != QString("component") && str != QString("bay"))
|
||||
{
|
||||
if(groupValue_[str].mapInfo.contains(curUuid_))
|
||||
valueMap = groupValue_[str].mapInfo[curUuid_];
|
||||
|
|
@ -129,11 +131,15 @@ void ItemPropertyDlg::createGroupView(const QString& str)
|
|||
contentDlg = new BaseInfoDlg(ui->stackedWidget);
|
||||
}
|
||||
else if(str == "base_extend" || str == QString::fromWCharArray(L"扩展信息")){
|
||||
//if(pPro->type() == pt)
|
||||
contentDlg = new CtExtraInfoDlg(ui->stackedWidget);
|
||||
if(pPro->type() == 4)
|
||||
contentDlg = new CtExtraInfoDlg(ui->stackedWidget);
|
||||
else if(pPro->type() == 5)
|
||||
contentDlg = new PtExtraInfoDlg(ui->stackedWidget);
|
||||
else
|
||||
contentDlg = new PropertyContentDlg(ui->stackedWidget);
|
||||
}
|
||||
else if(str == "bay" || str == QString::fromWCharArray(L"间隔信息")){
|
||||
|
||||
contentDlg = new BayInfoDlg(ui->stackedWidget);
|
||||
}
|
||||
else{
|
||||
contentDlg = new PropertyContentDlg(ui->stackedWidget);
|
||||
|
|
@ -144,6 +150,7 @@ void ItemPropertyDlg::createGroupView(const QString& str)
|
|||
contentDlg->createGroupView(groupInfo_[str]);
|
||||
}
|
||||
|
||||
contentDlg->setModelController(_curModelController); //传递modelControl
|
||||
groupViews_.insert(str, contentDlg);
|
||||
ui->stackedWidget->addWidget(contentDlg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,124 @@
|
|||
#include <QMessageBox>
|
||||
#include "measureSettingDlg.h"
|
||||
#include "bayInfoDlg.h"
|
||||
#include "graphicsDataModel/fixedPortsModel.h"
|
||||
#include "graphicsItem/graphicsBaseItem.h"
|
||||
#include "baseProperty.h"
|
||||
#include "ui_measureSettingDlg.h"
|
||||
|
||||
MeasureSettingDlg::MeasureSettingDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::measureSettingDlg)
|
||||
,_pBay(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
initial();
|
||||
}
|
||||
|
||||
MeasureSettingDlg::~MeasureSettingDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MeasureSettingDlg::initial()
|
||||
{
|
||||
connect(ui->btn_ok,&QPushButton::clicked,this,&MeasureSettingDlg::onOkClicked);
|
||||
connect(ui->btn_cancel,&QPushButton::clicked,this,&MeasureSettingDlg::onCancelClicked);
|
||||
connect(ui->cb_tag,&QComboBox::textActivated,this,&MeasureSettingDlg::onTagChanged);
|
||||
connect(ui->cb_name,&QComboBox::textActivated,this,&MeasureSettingDlg::onNameChanged);
|
||||
|
||||
// 设置正则验证器:1-5000整数
|
||||
QRegularExpression regExp("^(?:[1-9]|[1-9]\\d{1,2}|[1-4]\\d{3}|5000)$");
|
||||
QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp,ui->le_size);
|
||||
ui->le_size->setValidator(validator);
|
||||
}
|
||||
|
||||
void MeasureSettingDlg::showDlg()
|
||||
{
|
||||
clearData();
|
||||
QStringList lstTag;
|
||||
QStringList lstName;
|
||||
show();
|
||||
if(_pBay){
|
||||
auto lst = _pBay->getValidType();
|
||||
for(auto& item:lst){
|
||||
lstTag.append(item.tag);
|
||||
lstName.append(item.name);
|
||||
}
|
||||
ui->cb_tag->addItems(lstTag);
|
||||
ui->cb_name->addItems(lstName);
|
||||
|
||||
QStringList lstDevice;
|
||||
if(_pBay){
|
||||
FixedPortsModel* pModel = _pBay->getModelController();
|
||||
if(pModel){
|
||||
auto map = pModel->allItems();
|
||||
for(auto& pItem:map){
|
||||
auto pPro = pItem->getProperty();
|
||||
if(pPro){
|
||||
lstDevice.append(pPro->tag()); //根据本图的图元获取对应设备名
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui->cb_equip->addItems(lstDevice);
|
||||
}
|
||||
}
|
||||
|
||||
void MeasureSettingDlg::clearData()
|
||||
{
|
||||
if(ui->cb_tag->count())
|
||||
ui->cb_tag->clear();
|
||||
if(ui->cb_name->count())
|
||||
ui->cb_name->clear();
|
||||
ui->le_port->clear();
|
||||
ui->le_size->clear();
|
||||
}
|
||||
|
||||
void MeasureSettingDlg::onOkClicked()
|
||||
{
|
||||
MeasurementInfo info;
|
||||
info.tag = ui->cb_tag->currentText();
|
||||
info.name = ui->cb_name->currentText();
|
||||
info.equipment = ui->cb_equip->currentText();
|
||||
info.channel = ui->le_port->text();
|
||||
info.type = ui->cb_type->currentText();
|
||||
info.size = ui->le_size->text().toInt();
|
||||
if(info.channel.isEmpty() || info.size == 0){
|
||||
QMessageBox::information(NULL, QString("提示"), QString::fromWCharArray(L"参数未设置完毕"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(_pBay)
|
||||
_pBay->addMeasure(info);
|
||||
hide();
|
||||
}
|
||||
|
||||
void MeasureSettingDlg::onCancelClicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void MeasureSettingDlg::onTagChanged(const QString& str)
|
||||
{
|
||||
auto lst = _pBay->getValidType();
|
||||
for(auto& item:lst){
|
||||
if(item.tag == str){
|
||||
ui->cb_name->setCurrentText(item.name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MeasureSettingDlg::onNameChanged(const QString& str)
|
||||
{
|
||||
auto lst = _pBay->getValidType();
|
||||
for(auto& item:lst){
|
||||
if(item.name == str){
|
||||
ui->cb_tag->setCurrentText(item.tag);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +27,9 @@ void ProjectDiagramNameInput::initial()
|
|||
|
||||
void ProjectDiagramNameInput::onOkClicked()
|
||||
{
|
||||
if(DataBase::GetInstance()->getPageIdByName(ui->le_name->text()) != -1)
|
||||
if(DataBase::GetInstance()->getPageIdByName(ui->le_name->text()) == -1)
|
||||
{
|
||||
emit onGenerateClicked(ui->le_name->text());
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ void ProjectModelSetting::initial()
|
|||
connect(ui->cb_modelType,&QComboBox::currentTextChanged,this,&ProjectModelSetting::onCurrentTextChanged);
|
||||
_curPath = QCoreApplication::applicationDirPath()+"/proModelImage/";
|
||||
ui->cb_modelType->setPlaceholderText(" ");
|
||||
QRegularExpression regExp("[a-zA-Z0-9]+");
|
||||
QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp, this);
|
||||
ui->le_saveAs->setValidator(validator);
|
||||
}
|
||||
|
||||
void ProjectModelSetting::loadPicture()
|
||||
|
|
@ -132,7 +135,8 @@ void ProjectModelSetting::loadProject(const QString& sMeta)
|
|||
|
||||
void ProjectModelSetting::onOkClicked()
|
||||
{
|
||||
|
||||
_curItemData->setModelName(ui->cb_modelType->currentText());
|
||||
hide();
|
||||
}
|
||||
|
||||
void ProjectModelSetting::onCancelClicked()
|
||||
|
|
@ -283,14 +287,16 @@ void ProjectModelSetting::onCurrentTextChanged(const QString& text)
|
|||
{
|
||||
_curItemData->getModelProperty().release();
|
||||
PropertyModel model = ProjectModelManager::instance().getData()[_curItemData->metaModelName()][text].deepCopy();
|
||||
//PropertyModel model = ProjectModelManager::instance().getData()[_curItemData->metaModelName()][text];
|
||||
_curItemData->setModelProperty(model);
|
||||
ui->treeView_base->setModel(_curItemData->getModelProperty().pBase);
|
||||
ui->treeView_sub->setModel(_curItemData->getModelProperty().pSelect);
|
||||
ui->treeView_sub->expandAll();
|
||||
ui->treeView_base->expandAll();
|
||||
loadPicture();
|
||||
setSelectedItems(_curItemData->getModelProperty().modelSetting.mapSvg.keys());
|
||||
showTestPic(_curItemData->getModelProperty().modelSetting.mapSvg.first());
|
||||
if(!_curItemData->getModelProperty().modelSetting.mapSvg.isEmpty())
|
||||
setSelectedItems(_curItemData->getModelProperty().modelSetting.mapSvg.keys());
|
||||
//showTestPic(_curItemData->getModelProperty().modelSetting.mapSvg.first());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ void BaseSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene
|
|||
|
||||
if (items.count() == 1)
|
||||
{
|
||||
AbstractShape* item = qgraphicsitem_cast<AbstractShape*>(items.first());
|
||||
GraphicsBaseItem* item = qgraphicsitem_cast<GraphicsBaseItem*>(items.first());
|
||||
if(item)
|
||||
{
|
||||
if(ms_nDragHandle == H_none)
|
||||
|
|
@ -409,13 +409,9 @@ void BaseSelector::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event, Design
|
|||
GraphicsProjectModelItem* item = qgraphicsitem_cast<GraphicsProjectModelItem*>(items.first());
|
||||
if(item)
|
||||
{
|
||||
GraphicsItemType tpe = item->getItemType();
|
||||
if(tpe != GIT_link)
|
||||
{
|
||||
QString modelName = item->getModelName(); //todo:additem时填写模型类型
|
||||
QUuid uuid = item->itemId();
|
||||
_model->showModelDlg(modelName,uuid,item);
|
||||
}
|
||||
QString modelName = item->getModelName(); //todo:additem时填写模型类型
|
||||
QUuid uuid = item->itemId();
|
||||
_model->showModelDlg(modelName,uuid,item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ void ScalingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerSc
|
|||
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||
if (items.count() == 1)
|
||||
{
|
||||
AbstractShape* item = qgraphicsitem_cast<AbstractShape*>(items.first());
|
||||
GraphicsBaseItem* item = qgraphicsitem_cast<GraphicsBaseItem*>(items.first());
|
||||
if(item)
|
||||
{
|
||||
if(ms_nDragHandle != H_none)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,303 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>bayInfoDlg</class>
|
||||
<widget class="QDialog" name="bayInfoDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>784</width>
|
||||
<height>684</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,7">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>本元件对本间隔的量测贡献</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="5">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>SIZE</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QPushButton" name="btn_add">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>名称</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>TAG</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>设备</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>端子</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>类型</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_local">
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>本间隔的其他量测</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_other"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<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="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<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="1">
|
||||
<widget class="QComboBox" name="cb_jk"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<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="6" column="1">
|
||||
<widget class="QComboBox" name="cb_qt"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<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="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_title_bay">
|
||||
<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="3" column="1">
|
||||
<widget class="QComboBox" name="cb_dtgz"/>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,0">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QLineEdit" name="le_bayName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>序号</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_index_1"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>--</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_index_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="cb_gzlb"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<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="5" column="1">
|
||||
<widget class="QComboBox" name="cb_ztjc"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cb_zhbh"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>监控设备</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>bayManagerContentDlg</class>
|
||||
<widget class="QDialog" name="bayManagerContentDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>584</width>
|
||||
<height>562</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="2,3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>间隔信息</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<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="0" column="1">
|
||||
<widget class="QLineEdit" name="le_name"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>间隔序号</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="le_index"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<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="1">
|
||||
<widget class="QLineEdit" name="le_type"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>服役状态</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbtn_in">
|
||||
<property name="text">
|
||||
<string>IN</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbtn_out">
|
||||
<property name="text">
|
||||
<string>OUT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<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="1">
|
||||
<widget class="QLineEdit" name="le_from"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<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="3">
|
||||
<widget class="QLineEdit" name="le_to"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<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="4" column="1">
|
||||
<widget class="QLineEdit" name="le_voltage"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<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="4" column="3">
|
||||
<widget class="QLineEdit" name="le_fla"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<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="5" column="1">
|
||||
<widget class="QLineEdit" name="le_capacity"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>设备配置</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_zongHe">
|
||||
<attribute name="title">
|
||||
<string>综合保护</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tw_zongHe">
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_jianKong">
|
||||
<attribute name="title">
|
||||
<string>监控设备</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tw_jianKong">
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_dongTai">
|
||||
<attribute name="title">
|
||||
<string>动态感知</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tw_dongTai">
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_guZhang">
|
||||
<attribute name="title">
|
||||
<string>故障录波</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tw_guZhang">
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_zhuangTai">
|
||||
<attribute name="title">
|
||||
<string>状态检测</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tw_zhuangTai">
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_qiTa">
|
||||
<attribute name="title">
|
||||
<string>其他设备</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tw_qiTa">
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>bayManagerDlg</class>
|
||||
<widget class="QDialog" name="bayManagerDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>870</width>
|
||||
<height>632</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(209, 209, 209);</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>间隔管理</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>803</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="1,3">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>间隔列表</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="stackedWidget"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>469</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_ok">
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -0,0 +1,388 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>measureSettingDlg</class>
|
||||
<widget class="QDialog" name="measureSettingDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>439</width>
|
||||
<height>310</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,3,3,3,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(206, 206, 206);</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>量测设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>314</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>TAG/名称</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>TAG:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cb_tag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QComboBox" name="cb_name">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>设备/端子</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>设备:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cb_equip">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>端子:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_port">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>类型/SIZE</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>类型:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cb_type">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>遥测</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>遥信</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>遥控</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>遥调</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>整定值</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>SIZE:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_size">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_ok">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>完成</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -61,6 +61,8 @@ public:
|
|||
QJsonObject getPageContextByName(QString name);
|
||||
QList<pageInfo> getAllPage();
|
||||
/*********************************************************************************/
|
||||
bool insertMeasurement(QString tag,QString name,int type,QJsonObject dataSource,int size,int bayId,QUuid componentId);
|
||||
/*********************************************************************************/
|
||||
bool deleteComponentById(int id);
|
||||
void select();
|
||||
void parallelUpdate();
|
||||
|
|
@ -117,6 +119,7 @@ public:
|
|||
QMap<QString,propertyGroupState> getPublicInfo(); //获取公共属性组信息
|
||||
QMap<QString,projectManager> getProjectModelGroupInfo(const QString&); //获取指定工程模所有属性组信息<属性组名,属性信息>
|
||||
QMap<QUuid,PropertyValueInfo> selectGroupProperty(const QString& tableName,QMap<QString,propertyStateInfo> mapPro); //返回属性组表中的信息
|
||||
QList<measureAttributeType> getMeasureAttributeTypes(); //获取所有量测属性
|
||||
private:
|
||||
QMap<int,attributeGroup> _attributeGroup; //属性组的组
|
||||
QMap<int,dataType> _dataType; //数据类型组
|
||||
|
|
|
|||
|
|
@ -1056,6 +1056,35 @@ bool DataBase::deleteComponentById(int id)
|
|||
else
|
||||
return false;
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
bool DataBase::insertMeasurement(QString tag,QString name,int type,QJsonObject dataSource,int size,int bayId,QUuid componentId)
|
||||
{
|
||||
QString strSQL = "INSERT INTO measurement(tag, name, type, data_source, size, bay_id, component_id) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||
QJsonDocument dataDoc(dataSource);
|
||||
QString strData = dataDoc.toJson(QJsonDocument::Compact);
|
||||
|
||||
QVariantList params;
|
||||
params.append(tag);
|
||||
params.append(name);
|
||||
params.append(type);
|
||||
params.append(strData);
|
||||
params.append(size);
|
||||
params.append(bayId);
|
||||
params.append(componentId);
|
||||
|
||||
try
|
||||
{
|
||||
executeSQL(strSQL,false,params);
|
||||
return true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("DB", QString("Insert measurement fail"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
void DataBase::select()
|
||||
{
|
||||
|
|
@ -1905,6 +1934,176 @@ QMap<QUuid,PropertyValueInfo> DataBase::selectGroupProperty(const QString& table
|
|||
}
|
||||
}
|
||||
|
||||
QList<measureAttributeType> DataBase::getMeasureAttributeTypes()
|
||||
{
|
||||
QList<measureAttributeType> lst;
|
||||
QString strSQL = "SELECT attribute,attribute_name FROM basic.attribute WHERE is_visible = ?";
|
||||
QVariantList params;
|
||||
params.append(2);
|
||||
|
||||
try
|
||||
{
|
||||
QSqlQuery query = executeSQL(strSQL,false,params);
|
||||
while (query.next())
|
||||
{
|
||||
QString attName = query.value(0).toString();
|
||||
QString attTag = query.value(1).toString();
|
||||
|
||||
if(attName.contains("$")){ //包含$
|
||||
QStringList lst_dollar;
|
||||
lst_dollar<<"s1"<<"s2"<<"s3";
|
||||
if(attName.contains("sn")){ //同时包含$与sn,9个分支
|
||||
QStringList lst_sn;
|
||||
lst_sn<<"s1"<<"s2"<<"s3";
|
||||
|
||||
if(attName.contains("_$")){ //包含_$,特殊处理
|
||||
if(attName.first(1) == "I"){ //头字母为I
|
||||
QStringList lst_I;
|
||||
lst_I<<"a"<<"b"<<"c";
|
||||
|
||||
for(auto &i:lst_I)
|
||||
{
|
||||
QString tn1 = attName;
|
||||
QString tt1 = attTag;
|
||||
|
||||
QString name = tn1.replace("_$",i);
|
||||
QString tag = tt1.replace("_$",i);
|
||||
for(auto &sn:lst_sn)
|
||||
{
|
||||
QString tn2 = name;
|
||||
QString tt2 = tag;
|
||||
measureAttributeType measure;
|
||||
measure.name = tn2.replace("sn",sn);
|
||||
measure.tag = tt2.replace("sn",sn);
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{ //头字母为U
|
||||
QStringList lst_U;
|
||||
lst_U<<"AB"<<"BC"<<"CA";
|
||||
|
||||
for(auto &u:lst_U)
|
||||
{
|
||||
QString tn1 = attName;
|
||||
QString tt1 = attTag;
|
||||
|
||||
QString name = tn1.replace("_$",u);
|
||||
QString tag = tt1.replace("_$",u);
|
||||
for(auto &sn:lst_sn)
|
||||
{
|
||||
QString tn2 = name;
|
||||
QString tt2 = tag;
|
||||
measureAttributeType measure;
|
||||
measure.name = tn2.replace("sn",sn);
|
||||
measure.tag = tt2.replace("sn",sn);
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{ //只包含$与sn
|
||||
for(auto &dor:lst_dollar)
|
||||
{
|
||||
QString tn1 = attName;
|
||||
QString tt1 = attTag;
|
||||
|
||||
QString name = tn1.replace("$",dor);
|
||||
QString tag = tt1.replace("$",dor);
|
||||
for(auto &sn:lst_sn)
|
||||
{
|
||||
QString tn2 = name;
|
||||
QString tt2 = tag;
|
||||
measureAttributeType measure;
|
||||
measure.name = tn2.replace("sn",sn);
|
||||
measure.tag = tt2.replace("sn",sn);
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{ //不包含sn,3种分支
|
||||
if(attName.contains("_$")){ //包含_$
|
||||
if(attName.first(1) == "I"){ //头字母为I
|
||||
QStringList lst_I;
|
||||
lst_I<<"a"<<"b"<<"c";
|
||||
|
||||
for(auto &i:lst_I)
|
||||
{
|
||||
QString name = attName;
|
||||
QString tag = attTag;
|
||||
|
||||
measureAttributeType measure;
|
||||
measure.name = name.replace("_$",i);
|
||||
measure.tag = tag.replace("_$",i);
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
else{ //头字母为U
|
||||
QStringList lst_U;
|
||||
lst_U<<"AB"<<"BC"<<"CA";
|
||||
|
||||
for(auto &u:lst_U)
|
||||
{
|
||||
QString name = attName;
|
||||
QString tag = attTag;
|
||||
|
||||
measureAttributeType measure;
|
||||
measure.name = name.replace("_$",u);
|
||||
measure.tag = tag.replace("_$",u);
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{ //不包含_$
|
||||
QStringList lst_dollar;
|
||||
lst_dollar<<"s1"<<"s2"<<"s3";
|
||||
|
||||
for(auto &dor:lst_dollar)
|
||||
{
|
||||
QString name = attName;
|
||||
QString tag = attTag;
|
||||
|
||||
measureAttributeType measure;
|
||||
measure.name = name.replace("$",dor);
|
||||
measure.tag = tag.replace("$",dor);
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(attName.contains("sn")){ //只包含sn,3种分支
|
||||
QStringList lst_sn;
|
||||
lst_sn<<"s1"<<"s2"<<"s3";
|
||||
|
||||
for(auto &sn:lst_sn)
|
||||
{
|
||||
QString name = attName;
|
||||
QString tag = attTag;
|
||||
|
||||
measureAttributeType measure;
|
||||
measure.name = name.replace("sn",sn);
|
||||
measure.tag = tag.replace("sn",sn);
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
else{ //没有分支
|
||||
measureAttributeType measure;
|
||||
measure.name = attName;
|
||||
measure.tag = attTag;
|
||||
lst.append(measure);
|
||||
}
|
||||
}
|
||||
query.clear();
|
||||
return lst;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
return lst;
|
||||
LOG_ERROR("DB", QString("Select measureAttributeType fail"));
|
||||
}
|
||||
}
|
||||
|
||||
bool DataBase::createDynamicTable(const QString &tableName, const QStringList &fields)
|
||||
{
|
||||
QString strSQL = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
|
||||
|
|
|
|||
|
|
@ -140,16 +140,18 @@ MapProperty ProjectModelManager::addNewProject(const QString& sMeta,const QStrin
|
|||
if(nState)
|
||||
{
|
||||
QStandardItem* pGroup = nullptr;
|
||||
if(model.pSelect->findItems(propertyName).isEmpty())
|
||||
if(model.pSelect->findItems(property).isEmpty())
|
||||
{
|
||||
pGroup = new QStandardItem(property);
|
||||
model.pSelect->appendRow(pGroup); //属性的组未存在,将组添加到model
|
||||
}
|
||||
else
|
||||
{
|
||||
pGroup = model.pSelect->findItems(propertyName)[0];
|
||||
pGroup = model.pSelect->findItems(property)[0];
|
||||
}
|
||||
|
||||
//QModelIndex index = findIndex(model.pSelect,propertyName);
|
||||
|
||||
if(pGroup){
|
||||
pGroup->appendRow(pItem);
|
||||
sta.checkState = true;
|
||||
|
|
@ -159,14 +161,14 @@ MapProperty ProjectModelManager::addNewProject(const QString& sMeta,const QStrin
|
|||
else
|
||||
{
|
||||
QStandardItem* pGroup = nullptr;
|
||||
if(model.pBase->findItems(propertyName).isEmpty())
|
||||
if(model.pBase->findItems(property).isEmpty())
|
||||
{
|
||||
pGroup = new QStandardItem(property);
|
||||
model.pBase->appendRow(pGroup); //属性的组未存在,将组添加到model
|
||||
}
|
||||
else
|
||||
{
|
||||
pGroup = model.pBase->findItems(propertyName)[0];
|
||||
pGroup = model.pBase->findItems(property)[0];
|
||||
}
|
||||
|
||||
if(pGroup){
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ void CMainWindow::initializeDockUi()
|
|||
void CMainWindow::initializeAction()
|
||||
{
|
||||
//撤销、重做
|
||||
m_pUndoStack = new QUndoStack(this);
|
||||
/*m_pUndoStack = new QUndoStack(this);
|
||||
ui->actionUndo = m_pUndoStack->createUndoAction(this, tr("撤销"));
|
||||
ui->actionUndo->setIcon(QIcon::fromTheme(QString::fromUtf8("edit-undo")));
|
||||
ui->actionUndo->setShortcuts(QKeySequence::Undo);
|
||||
|
|
@ -119,14 +119,14 @@ void CMainWindow::initializeAction()
|
|||
ui->actionUndo->setEnabled(m_pUndoStack->canUndo());
|
||||
ui->actionRedo->setEnabled(m_pUndoStack->canRedo());
|
||||
|
||||
ui->actionDelete->setShortcut(QKeySequence::Delete);
|
||||
ui->actionDelete->setShortcut(QKeySequence::Delete);*/
|
||||
|
||||
connect(ui->actionDelete, SIGNAL(triggered()), this, SLOT(onSignal_deleteItem()));
|
||||
connect(ui->actionZoomIn, SIGNAL(triggered()), this, SLOT(onAction_zoomIn()));
|
||||
connect(ui->actionZoomOut, SIGNAL(triggered()), this, SLOT(onAction_zoomOut()));
|
||||
connect(ui->actionZoomFit, SIGNAL(triggered()), this, SLOT(onAction_zoomFit()));
|
||||
connect(ui->actionGroup, SIGNAL(triggered()), this, SLOT(onAction_createGroup()));
|
||||
connect(ui->actionUngroup, SIGNAL(triggered()), this, SLOT(onAction_destroyGroup()));
|
||||
//connect(ui->actionDelete, SIGNAL(triggered()), this, SLOT(onSignal_deleteItem()));
|
||||
//connect(ui->actionZoomIn, SIGNAL(triggered()), this, SLOT(onAction_zoomIn()));
|
||||
//connect(ui->actionZoomOut, SIGNAL(triggered()), this, SLOT(onAction_zoomOut()));
|
||||
//connect(ui->actionZoomFit, SIGNAL(triggered()), this, SLOT(onAction_zoomFit()));
|
||||
//connect(ui->actionGroup, SIGNAL(triggered()), this, SLOT(onAction_createGroup()));
|
||||
//connect(ui->actionUngroup, SIGNAL(triggered()), this, SLOT(onAction_destroyGroup()));
|
||||
|
||||
connect(m_pTopologyView,&TopologyView::entityCreate,m_pDiagramCavas,&DiagramCavas::onSignal_createEntity);
|
||||
connect(m_pTopologyView,&TopologyView::entityChange,m_pDiagramCavas,&DiagramCavas::onSignal_changeEntity);
|
||||
|
|
|
|||
|
|
@ -74,18 +74,6 @@
|
|||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCopy"/>
|
||||
<addaction name="actionCut"/>
|
||||
<addaction name="actionPast"/>
|
||||
<addaction name="actionDelete"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionZoomIn"/>
|
||||
<addaction name="actionZoomOut"/>
|
||||
<addaction name="actionZoomFit"/>
|
||||
<addaction name="actionGrid"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionGroup"/>
|
||||
<addaction name="actionUngroup"/>
|
||||
</widget>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
|
|
|
|||
Loading…
Reference in New Issue