add base model diagram
This commit is contained in:
parent
2b4c815b26
commit
e67549a544
|
|
@ -33,27 +33,43 @@ class ModelProperty:public AbstractProperty //模型基类
|
||||||
public:
|
public:
|
||||||
ModelProperty(QObject* parent);
|
ModelProperty(QObject* parent);
|
||||||
virtual ~ModelProperty();
|
virtual ~ModelProperty();
|
||||||
virtual void setType(int n) {nType = n;}
|
virtual void setType(int n) {nType = n;} //设置实际类型
|
||||||
virtual int type() const {return nType;}
|
virtual int type() const {return nType;}
|
||||||
|
virtual void setGraphicsType(int n) {nGraphicsType = n;} //设置显示类型
|
||||||
|
virtual int graphicsType() const {return nGraphicsType;}
|
||||||
virtual void setModelName(QString sName) {sModelName = sName;}
|
virtual void setModelName(QString sName) {sModelName = sName;}
|
||||||
virtual QString modelName() const {return sModelName;}
|
virtual QString modelName() const {return sModelName;}
|
||||||
virtual void setMetaModelName(QString sName) {sMetaName = sName;}
|
virtual void setMetaModelName(QString sName) {sMetaName = sName;}
|
||||||
virtual QString metaModelName() const {return sMetaName;}
|
virtual QString metaModelName() const {return sMetaName;}
|
||||||
virtual void notifyUpdate(){emit updateData();}
|
virtual void notifyUpdate(){emit updateData();}
|
||||||
|
|
||||||
|
void setPrepareDelete(bool b) {_prepareDelete = b;}
|
||||||
|
bool prepareDelete() const {return _prepareDelete;}
|
||||||
|
void setDataChanged(bool b) {_dataChanged = b;} //数据变换标签
|
||||||
|
bool dataChanged() const {return _dataChanged;}
|
||||||
signals:
|
signals:
|
||||||
void updateData(); //通知数据拥有者更新
|
void updateData(); //通知数据拥有者更新
|
||||||
protected:
|
protected:
|
||||||
int nType; //设备类型
|
int nType; //设备类型
|
||||||
|
int nGraphicsType;
|
||||||
QString sModelName; //模型名
|
QString sModelName; //模型名
|
||||||
QString sMetaName; //元模型名
|
QString sMetaName; //元模型名
|
||||||
|
|
||||||
|
bool _dataChanged; //数据状态,为真则写入库
|
||||||
|
bool _prepareDelete; //状态,为真准备删除
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BaseProperty;
|
||||||
class BaseModelProperty:public ModelProperty //图像基模属性
|
class BaseModelProperty:public ModelProperty //图像基模属性
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BaseModelProperty(QObject* parent);
|
BaseModelProperty(QObject* parent);
|
||||||
virtual ~BaseModelProperty();
|
virtual ~BaseModelProperty();
|
||||||
|
|
||||||
|
virtual void addProData(QString sPage,BaseProperty* pData) {_generatedData.insert(sPage,pData);}
|
||||||
|
private:
|
||||||
|
QMap<QString,BaseProperty*> _generatedData; //该数据生成过的工程模数据
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseProperty:public ModelProperty //图像工程模模属性类,存放电路元件属性
|
class BaseProperty:public ModelProperty //图像工程模模属性类,存放电路元件属性
|
||||||
|
|
@ -84,10 +100,6 @@ public:
|
||||||
void setStation(const QString& s) {sStation = s;}
|
void setStation(const QString& s) {sStation = s;}
|
||||||
QString station() const {return sStation;}
|
QString station() const {return sStation;}
|
||||||
|
|
||||||
void setPrepareDelete(bool b) {_prepareDelete = b;}
|
|
||||||
bool prepareDelete() const {return _prepareDelete;}
|
|
||||||
void setDataChanged(bool b) {_dataChanged = b;} //数据变换标签
|
|
||||||
bool dataChanged() const {return _dataChanged;}
|
|
||||||
protected:
|
protected:
|
||||||
QString sPath;
|
QString sPath;
|
||||||
QString sDescription;
|
QString sDescription;
|
||||||
|
|
@ -100,8 +112,6 @@ protected:
|
||||||
QJsonObject jConnectedBus;
|
QJsonObject jConnectedBus;
|
||||||
QJsonObject jLabel;
|
QJsonObject jLabel;
|
||||||
|
|
||||||
bool _dataChanged; //数据状态,为真则写入库
|
|
||||||
bool _prepareDelete; //状态,为真准备删除
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QMap<QString,QVariant> VariableMap; //属性名,值
|
typedef QMap<QString,QVariant> VariableMap; //属性名,值
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,8 @@ struct modelType //模型类型
|
||||||
int id = 0;
|
int id = 0;
|
||||||
QString modelType;
|
QString modelType;
|
||||||
QString modelName;
|
QString modelName;
|
||||||
|
int graphicEelement; //类型
|
||||||
|
QByteArray icon; //图片
|
||||||
QString remark;
|
QString remark;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -490,6 +492,7 @@ struct DiagramInfo //组态图结构信息
|
||||||
QString sName;
|
QString sName;
|
||||||
QString sTag;
|
QString sTag;
|
||||||
QVariant parentId;
|
QVariant parentId;
|
||||||
|
QString sBasePageName; //基模组态图名称
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DiagramContent {
|
struct DiagramContent {
|
||||||
|
|
@ -517,9 +520,22 @@ struct CtExtraInfo
|
||||||
QString accuracyClass; //精度等级
|
QString accuracyClass; //精度等级
|
||||||
QString secondaryLoadCapacity; //二次负载容量
|
QString secondaryLoadCapacity; //二次负载容量
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//==================================================
|
||||||
|
struct baseComponentInfo //基模图元数据
|
||||||
|
{
|
||||||
|
int id = 0;
|
||||||
|
QUuid uuid;
|
||||||
|
QString name;
|
||||||
|
QString tag;
|
||||||
|
int typeId = 0;
|
||||||
|
QJsonObject context;
|
||||||
|
QString metaMmodel;
|
||||||
|
QString projectModel;
|
||||||
|
};
|
||||||
//==================================================
|
//==================================================
|
||||||
|
|
||||||
struct componentInfo
|
struct componentInfo //工程模图元数据
|
||||||
{
|
{
|
||||||
int id = 0;
|
int id = 0;
|
||||||
QUuid uuid;
|
QUuid uuid;
|
||||||
|
|
@ -540,13 +556,20 @@ struct componentInfo
|
||||||
int op = 0;
|
int op = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct componentTypeInfo //元件类型
|
||||||
|
{
|
||||||
|
int id = 0;
|
||||||
|
QString type;
|
||||||
|
QString name;
|
||||||
|
QJsonObject config;
|
||||||
|
};
|
||||||
|
|
||||||
struct topologicInfo
|
struct topologicInfo
|
||||||
{
|
{
|
||||||
int id = -1;
|
int id = -1;
|
||||||
QUuid uuid_from;
|
QUuid uuid_from;
|
||||||
QUuid uuid_to;
|
QUuid uuid_to;
|
||||||
QUuid from_pin;
|
QJsonObject context;
|
||||||
QUuid to_pin;
|
|
||||||
int flag;
|
int flag;
|
||||||
QString description;
|
QString description;
|
||||||
int op;
|
int op;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ AbstractProperty::~AbstractProperty()
|
||||||
ModelProperty::ModelProperty(QObject* parent)
|
ModelProperty::ModelProperty(QObject* parent)
|
||||||
:AbstractProperty(parent)
|
:AbstractProperty(parent)
|
||||||
{
|
{
|
||||||
|
_dataChanged = false;
|
||||||
|
_prepareDelete = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
ModelProperty::~ModelProperty()
|
ModelProperty::~ModelProperty()
|
||||||
|
|
@ -43,9 +45,6 @@ BaseProperty::BaseProperty(QObject* parent)
|
||||||
nState = 1;
|
nState = 1;
|
||||||
nStatus = 1;
|
nStatus = 1;
|
||||||
|
|
||||||
_dataChanged = false;
|
|
||||||
_prepareDelete = false;
|
|
||||||
|
|
||||||
sGrid=QString("1"); //暂时修改,数据库字段不为空
|
sGrid=QString("1"); //暂时修改,数据库字段不为空
|
||||||
sZone=QString("1");
|
sZone=QString("1");
|
||||||
sStation=QString("1");
|
sStation=QString("1");
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/baseContentDlg.h
|
include/baseContentDlg.h
|
||||||
include/ptExtraInfoDlg.h
|
include/ptExtraInfoDlg.h
|
||||||
include/ctExtraInfoDlg.h
|
include/ctExtraInfoDlg.h
|
||||||
|
include/projectModelSetting.h
|
||||||
include/diagramEditor/editPanel.h
|
include/diagramEditor/editPanel.h
|
||||||
include/diagramEditor/editView.h
|
include/diagramEditor/editView.h
|
||||||
include/diagramEditor/editScene.h
|
include/diagramEditor/editScene.h
|
||||||
|
|
@ -80,6 +81,7 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/baseContentDlg.cpp
|
source/baseContentDlg.cpp
|
||||||
source/ptExtraInfoDlg.cpp
|
source/ptExtraInfoDlg.cpp
|
||||||
source/ctExtraInfoDlg.cpp
|
source/ctExtraInfoDlg.cpp
|
||||||
|
source/projectModelSetting.cpp
|
||||||
source/diagramEditor/editPanel.cpp
|
source/diagramEditor/editPanel.cpp
|
||||||
source/diagramEditor/editView.cpp
|
source/diagramEditor/editView.cpp
|
||||||
source/diagramEditor/editScene.cpp
|
source/diagramEditor/editScene.cpp
|
||||||
|
|
@ -129,6 +131,7 @@ set(UI_FILES
|
||||||
ui/ctExtraInfoDlg.ui
|
ui/ctExtraInfoDlg.ui
|
||||||
ui/editorSettingDlg.ui
|
ui/editorSettingDlg.ui
|
||||||
ui/diagramEditorWizard.ui
|
ui/diagramEditorWizard.ui
|
||||||
|
ui/projectModelSetting.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,17 @@ class ElectricBaseModelSvgItem :public GraphicsBaseModelItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricBaseModelSvgItem(const QRect &rect, bool genNewPort = true,QGraphicsItem *parent = 0); //genNewPort生成新接线点
|
ElectricBaseModelSvgItem(const QRect &rect, QGraphicsItem *parent = 0); //genNewPort生成新接线点
|
||||||
virtual ~ElectricBaseModelSvgItem();
|
virtual ~ElectricBaseModelSvgItem();
|
||||||
void updateCoordinate();
|
void updateCoordinate();
|
||||||
void move(const QPointF&);
|
void move(const QPointF&);
|
||||||
|
void loadSvg(const QByteArray&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QPainterPath shape();
|
virtual QPainterPath shape();
|
||||||
virtual void editShape(int, const QPointF&);
|
virtual void editShape(int, const QPointF&);
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
|
||||||
virtual void loadSvg(const QString&);
|
|
||||||
protected:
|
protected:
|
||||||
QRectF m_lastBoudingRect; //记录上一时刻的boundingRect
|
QRectF m_lastBoudingRect; //记录上一时刻的boundingRect
|
||||||
QSvgRenderer* m_pRender;
|
QSvgRenderer* m_pRender;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ public:
|
||||||
DiagramCavas(QWidget *parent = nullptr);
|
DiagramCavas(QWidget *parent = nullptr);
|
||||||
~DiagramCavas();
|
~DiagramCavas();
|
||||||
|
|
||||||
|
DrawingPanel* getPanel(QString);
|
||||||
public:
|
public:
|
||||||
void initial();
|
void initial();
|
||||||
public slots:
|
public slots:
|
||||||
|
|
@ -47,7 +48,7 @@ public slots:
|
||||||
void onSignal_deleteDiagram(DiagramInfo);
|
void onSignal_deleteDiagram(DiagramInfo);
|
||||||
void onSignal_selectDiagram(DiagramInfo);
|
void onSignal_selectDiagram(DiagramInfo);
|
||||||
|
|
||||||
void onCreateTestBaseModelDiagram();
|
void onCreateTestBaseModelDiagram(); //生成测试基模图
|
||||||
/******************************生成组态***********************************/
|
/******************************生成组态***********************************/
|
||||||
void onSignal_createEditPanel(QString);
|
void onSignal_createEditPanel(QString);
|
||||||
EditPanel* onSignal_addEditPanel(QString);
|
EditPanel* onSignal_addEditPanel(QString);
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ class BaseProperty;
|
||||||
class BaseModelProperty;
|
class BaseModelProperty;
|
||||||
class DesignerScene;
|
class DesignerScene;
|
||||||
class HttpInterface;
|
class HttpInterface;
|
||||||
|
class DiagramCavas;
|
||||||
struct Connection;
|
struct Connection;
|
||||||
|
|
||||||
class PowerEntity;
|
class PowerEntity;
|
||||||
class ElectricConnectLineItem;
|
class ElectricConnectLineItem;
|
||||||
|
class ProjectModelSetting;
|
||||||
|
|
||||||
class FixedPortsModel : public BaseModel, public Serializable
|
class FixedPortsModel : public BaseModel, public Serializable
|
||||||
{
|
{
|
||||||
|
|
@ -46,13 +48,15 @@ public:
|
||||||
QWidget* getTopWidget();
|
QWidget* getTopWidget();
|
||||||
QPointF getTerminalPos(const QString& sTerminalId); //获取拓扑接线点在当前diagram中的位置
|
QPointF getTerminalPos(const QString& sTerminalId); //获取拓扑接线点在当前diagram中的位置
|
||||||
ElectricConnectLineItem* getLineItemById(const QString& terminalId);
|
ElectricConnectLineItem* getLineItemById(const QString& terminalId);
|
||||||
|
template<typename TypeLine> void establishConnection(GraphicsBaseItem*,GraphicsBaseItem*,TypeLine*); //在两个item之间建立连接
|
||||||
|
QPointF calculateBusPortPos(GraphicsBaseItem* pBus,GraphicsBaseItem* item); //计算母线上接线点位置
|
||||||
|
|
||||||
void showModelDlg(const QString&,QUuid,GraphicsProjectModelItem*); //点击时显示指定模型的dlg、指定item的数据(模型名,对象Uuid,触发事件的item)
|
void showModelDlg(const QString&,QUuid,GraphicsProjectModelItem*); //点击时显示指定模型的dlg、指定item的数据(模型名,对象Uuid,触发事件的item)
|
||||||
void initialPropertyDlg(); //初始化属性设置dlg,每个模型拥各自的dlg
|
void initialPropertyDlg(); //初始化属性设置dlg,每个模型拥各自的dlg
|
||||||
void generatePropertyDlg(const QString&);
|
void generatePropertyDlg(const QString&);
|
||||||
ConfigurationDiagram* getTopologyDiagram(); //返回当前组态图的拓扑实体
|
ConfigurationDiagram* getTopologyDiagram(); //返回当前组态图的拓扑实体
|
||||||
void createTopoTerminalsByItem(GraphicsBaseItem*); //通过图形对象创建port接线点(新建)
|
void createTopoTerminalsByItem(GraphicsBaseItem*,ModelFunctionType funType = ModelFunctionType::ProjectModel); //通过图形对象创建port接线点(新建)
|
||||||
void createTopoTerminalsByData(PowerEntity* pParent,QJsonObject componentCon); //通过componet数据创建port接线点(加载)
|
void createTopoTerminalsByData(PowerEntity* pParent,QJsonObject componentCon,ModelFunctionType funType = ModelFunctionType::ProjectModel); //通过componet数据创建port接线点(加载)
|
||||||
bool isItemValid(GraphicsProjectModelItem*); //判断item是否可以连接
|
bool isItemValid(GraphicsProjectModelItem*); //判断item是否可以连接
|
||||||
|
|
||||||
void insertProjectModelName(QString,QString); //插入工程模类型(生成工程模时调用)
|
void insertProjectModelName(QString,QString); //插入工程模类型(生成工程模时调用)
|
||||||
|
|
@ -61,7 +65,12 @@ public:
|
||||||
QVector<Connection> allBaseConnections();
|
QVector<Connection> allBaseConnections();
|
||||||
QMap<QUuid,QPointF> allBaseNodePos() const;
|
QMap<QUuid,QPointF> allBaseNodePos() const;
|
||||||
|
|
||||||
|
bool addBaseItem(QUuid uuid,GraphicsBaseModelItem*);
|
||||||
BaseModelProperty* addBaseNodeData(QUuid id,int type,QString name,QString metaName); //添加图元基模数据
|
BaseModelProperty* addBaseNodeData(QUuid id,int type,QString name,QString metaName); //添加图元基模数据
|
||||||
|
|
||||||
|
void showProjectModelSettingDlg(GraphicsBaseModelItem*); //在基模拓扑图上打开工程模设置对话框
|
||||||
|
void generateProjectModel(const QString&,QList<BaseModelProperty*>); //由基模生成工程模
|
||||||
|
void addTestData(); //生成测试基模
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void activatePage(const QString&); //激活当前model所在page
|
void activatePage(const QString&); //激活当前model所在page
|
||||||
public:
|
public:
|
||||||
|
|
@ -69,6 +78,7 @@ public:
|
||||||
QString pageName() const {return _pageName;}
|
QString pageName() const {return _pageName;}
|
||||||
void activateModel() {Q_EMIT activatePage(_pageName);} //发送激活信号(点击)
|
void activateModel() {Q_EMIT activatePage(_pageName);} //发送激活信号(点击)
|
||||||
void startHttpRequest(); //开始请求数据(运行时)
|
void startHttpRequest(); //开始请求数据(运行时)
|
||||||
|
void setCavas(DiagramCavas* p) {_cavas = p;} //设置所属顶层容器
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onSignal_ifExits(QUuid id,const QString&,int type,GraphicsProjectModelItem*); //判断用户输入的名称是否已存在
|
void onSignal_ifExits(QUuid id,const QString&,int type,GraphicsProjectModelItem*); //判断用户输入的名称是否已存在
|
||||||
void onTimeOut();
|
void onTimeOut();
|
||||||
|
|
@ -80,6 +90,7 @@ private:
|
||||||
QMap<QUuid,GraphicsBaseModelItem*> _baseItem; //基模对象
|
QMap<QUuid,GraphicsBaseModelItem*> _baseItem; //基模对象
|
||||||
|
|
||||||
QString _pageName;
|
QString _pageName;
|
||||||
|
DiagramCavas* _cavas;
|
||||||
DesignerScene* _scene;
|
DesignerScene* _scene;
|
||||||
DrawingPanel* _widget; //顶层widget
|
DrawingPanel* _widget; //顶层widget
|
||||||
HttpInterface* _Interface;
|
HttpInterface* _Interface;
|
||||||
|
|
@ -89,6 +100,7 @@ private:
|
||||||
|
|
||||||
QMap<QString,modelStateInfo> _modelStateInfo; //模型结构信息
|
QMap<QString,modelStateInfo> _modelStateInfo; //模型结构信息
|
||||||
QMap<QString,modelDataInfo> _modelDataInfo; //模型数据信息
|
QMap<QString,modelDataInfo> _modelDataInfo; //模型数据信息
|
||||||
|
ProjectModelSetting* m_proModelSettingDlg;
|
||||||
public:
|
public:
|
||||||
static bool _dataInitialised;
|
static bool _dataInitialised;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public:
|
||||||
void calculatePath();
|
void calculatePath();
|
||||||
void resetCurLine(){_curLine = QPoint();}
|
void resetCurLine(){_curLine = QPoint();}
|
||||||
|
|
||||||
void setConnection(Connection con){m_connectState = con;}
|
void setConnection(Connection con){m_connectState = con;} //保留,用以获取当前图中的连接
|
||||||
Connection getConnection() const {return m_connectState;}
|
Connection getConnection() const {return m_connectState;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -461,16 +461,21 @@ public:
|
||||||
virtual bool itemChanged() const {return _itemChanged;}
|
virtual bool itemChanged() const {return _itemChanged;}
|
||||||
virtual void setItemType(GraphicsItemType type){m_Itemtype = type;}
|
virtual void setItemType(GraphicsItemType type){m_Itemtype = type;}
|
||||||
virtual GraphicsItemType getItemType() const {return m_Itemtype;}
|
virtual GraphicsItemType getItemType() const {return m_Itemtype;}
|
||||||
|
virtual void setInnerType(int type){m_inerType = type;}
|
||||||
|
virtual int getInnerType() const {return m_inerType;}
|
||||||
virtual void renderSelectBackground(QPainter*);
|
virtual void renderSelectBackground(QPainter*);
|
||||||
virtual ItemPort* getPortById(QString) const;
|
virtual ItemPort* getPortById(QString) const;
|
||||||
virtual ItemPort* getPortPtr(int) const;
|
virtual ItemPort* getPortPtr(int) const;
|
||||||
virtual ItemControlHandle* getHandlePtr(int) const;
|
virtual ItemControlHandle* getHandlePtr(int) const;
|
||||||
virtual QMap<QString,ItemPort*> getPorts() {return m_mapPort;}
|
virtual QMap<QString,ItemPort*> getPorts() {return m_mapPort;}
|
||||||
|
//virtual GraphicsBaseItem*
|
||||||
|
virtual void initialPortsByDatabase(); //从数据库初始化port信息
|
||||||
public slots:
|
public slots:
|
||||||
void onUpdateData(); //data发送的更新通知
|
void onUpdateData(); //data发送的更新通知
|
||||||
protected:
|
protected:
|
||||||
QUuid m_itemId;
|
QUuid m_itemId;
|
||||||
GraphicsItemType m_Itemtype;
|
GraphicsItemType m_Itemtype; //显示类型
|
||||||
|
int m_inerType; //实际类型
|
||||||
ModelProperty* _property;
|
ModelProperty* _property;
|
||||||
PowerEntity* _pEntity; //图元拓扑
|
PowerEntity* _pEntity; //图元拓扑
|
||||||
bool _itemChanged; //图元变化标志,判断是否需要保存
|
bool _itemChanged; //图元变化标志,判断是否需要保存
|
||||||
|
|
@ -483,6 +488,8 @@ class GraphicsBaseModelItem : public GraphicsBaseItem //基模item
|
||||||
public:
|
public:
|
||||||
GraphicsBaseModelItem(QGraphicsItem *parent);
|
GraphicsBaseModelItem(QGraphicsItem *parent);
|
||||||
virtual ~GraphicsBaseModelItem();
|
virtual ~GraphicsBaseModelItem();
|
||||||
|
protected:
|
||||||
|
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange, const QVariant&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GraphicsProjectModelItem : public GraphicsBaseItem //工程模item
|
class GraphicsProjectModelItem : public GraphicsBaseItem //工程模item
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef PROJECTMODELSETTING_H
|
||||||
|
#define PROJECTMODELSETTING_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class projectModelSetting; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class GraphicsBaseModelItem;
|
||||||
|
|
||||||
|
class ProjectModelSetting : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ProjectModelSetting(QWidget *parent = nullptr);
|
||||||
|
~ProjectModelSetting();
|
||||||
|
|
||||||
|
void initial();
|
||||||
|
void showDlg(GraphicsBaseModelItem*);
|
||||||
|
protected:
|
||||||
|
void onOkClicked();
|
||||||
|
void onCancelClicked();
|
||||||
|
void onSaveAsClicked();
|
||||||
|
|
||||||
|
void onAddClicked(); //添加属性
|
||||||
|
void onDecreaseClicked(); //减少属性
|
||||||
|
private:
|
||||||
|
Ui::projectModelSetting *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -51,14 +51,14 @@ public:
|
||||||
virtual ~BaseSelector();
|
virtual ~BaseSelector();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode);
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode);
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode);
|
||||||
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode);
|
||||||
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*);
|
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*,DiagramMode);
|
||||||
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*);
|
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*,DiagramMode);
|
||||||
virtual void dropEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*);
|
virtual void dropEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*,DiagramMode);
|
||||||
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event,DesignerScene*);
|
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event,DesignerScene*,DiagramMode);
|
||||||
|
|
||||||
SelectorType getSelectorType() { return m_type; }
|
SelectorType getSelectorType() { return m_type; }
|
||||||
//void setOperationMode(OperationMode m) { m_opMode = m; }
|
//void setOperationMode(OperationMode m) { m_opMode = m; }
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ public:
|
||||||
void setTargetHighLight(bool val); //设置目标高亮
|
void setTargetHighLight(bool val); //设置目标高亮
|
||||||
void createConnectLline(GraphicsProjectModelItem* connecting,GraphicsProjectModelItem* touched,DesignerScene* scene);
|
void createConnectLline(GraphicsProjectModelItem* connecting,GraphicsProjectModelItem* touched,DesignerScene* scene);
|
||||||
public:
|
public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
private:
|
private:
|
||||||
GraphicsProjectModelItem* m_pConnectingItem;
|
GraphicsProjectModelItem* m_pConnectingItem;
|
||||||
GraphicsProjectModelItem* m_pTouchedItem; //连线时接触的对象
|
GraphicsProjectModelItem* m_pTouchedItem; //连线时接触的对象
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ public:
|
||||||
virtual ~CreatingSelector();
|
virtual ~CreatingSelector();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
|
|
||||||
void setCreatingItem(modelStateInfo& info) { m_creatingItemInfo=info; }
|
void setCreatingItem(modelStateInfo& info) { m_creatingItemInfo=info; }
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ public:
|
||||||
virtual ~EditingSelector();
|
virtual ~EditingSelector();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GraphicsProjectModelItem* m_pEditingItem;
|
GraphicsProjectModelItem* m_pEditingItem;
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ public:
|
||||||
explicit LinkMovingSelector(FixedPortsModel* model,QObject *parent = 0);
|
explicit LinkMovingSelector(FixedPortsModel* model,QObject *parent = 0);
|
||||||
virtual ~LinkMovingSelector();
|
virtual ~LinkMovingSelector();
|
||||||
public:
|
public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
private:
|
private:
|
||||||
ElectricConnectLineItem* m_pMovingLine;
|
ElectricConnectLineItem* m_pMovingLine;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ public:
|
||||||
explicit MovingSelector(FixedPortsModel* model,QObject *parent = 0);
|
explicit MovingSelector(FixedPortsModel* model,QObject *parent = 0);
|
||||||
virtual ~MovingSelector();
|
virtual ~MovingSelector();
|
||||||
public:
|
public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ public:
|
||||||
virtual ~RotationSelector();
|
virtual ~RotationSelector();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ public:
|
||||||
virtual ~ScalingSelector();
|
virtual ~ScalingSelector();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointF m_scalBasePoint;
|
QPointF m_scalBasePoint;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ public:
|
||||||
explicit SubMovingSelector(FixedPortsModel* model,QObject *parent = 0);
|
explicit SubMovingSelector(FixedPortsModel* model,QObject *parent = 0);
|
||||||
virtual ~SubMovingSelector();
|
virtual ~SubMovingSelector();
|
||||||
public:
|
public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*, DesignerScene*,DiagramMode sceneMode);
|
||||||
private:
|
private:
|
||||||
GraphicsProjectModelItem* m_pParentItem;
|
GraphicsProjectModelItem* m_pParentItem;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include <QSvgRenderer>
|
#include <QSvgRenderer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
ElectricBaseModelSvgItem::ElectricBaseModelSvgItem(const QRect &rect, bool autoGenPort,QGraphicsItem *parent)
|
ElectricBaseModelSvgItem::ElectricBaseModelSvgItem(const QRect &rect, QGraphicsItem *parent)
|
||||||
: GraphicsBaseModelItem(parent),m_pRender(nullptr)
|
: GraphicsBaseModelItem(parent),m_pRender(nullptr)
|
||||||
{
|
{
|
||||||
m_lastBoudingRect = rect;
|
m_lastBoudingRect = rect;
|
||||||
|
|
@ -63,12 +63,44 @@ void ElectricBaseModelSvgItem::paint(QPainter* painter, const QStyleOptionGraphi
|
||||||
if (option->state & QStyle::State_Selected) //是选中状态,绘制选中框
|
if (option->state & QStyle::State_Selected) //是选中状态,绘制选中框
|
||||||
{
|
{
|
||||||
renderSelectBackground(painter);
|
renderSelectBackground(painter);
|
||||||
|
/*int nPenWidth = 1;
|
||||||
|
painter->setPen(QPen(QColor(135,206,235,180))); //蓝色的外框
|
||||||
|
|
||||||
|
painter->setBrush(QBrush(QColor(135,206,235,180)));
|
||||||
|
|
||||||
|
double dx = m_boundingRect_selected.x();
|
||||||
|
double dy = m_boundingRect_selected.y();
|
||||||
|
double dWidth = m_boundingRect_selected.width();
|
||||||
|
double dHeight = m_boundingRect_selected.height();
|
||||||
|
|
||||||
|
|
||||||
|
//画弧线0度是3点钟方向
|
||||||
|
if(dWidth > dHeight)
|
||||||
|
{
|
||||||
|
painter->drawRect(m_boundingRect_selected);
|
||||||
|
painter->drawChord(dx-dHeight*0.5,dy,dHeight,dHeight,90*16,180*16);
|
||||||
|
painter->drawChord(dx+dWidth-dHeight*0.5,dy,dHeight,dHeight,(-90)*16,180*16);
|
||||||
|
}
|
||||||
|
else if(dWidth < dHeight)
|
||||||
|
{
|
||||||
|
painter->drawRect(m_boundingRect_selected);
|
||||||
|
painter->drawChord(dx,dy-dWidth*0.5,dWidth,dWidth,0*16,180*16);
|
||||||
|
painter->drawChord(dx,dy+dHeight-dWidth*0.5,dWidth,dWidth,180*16,180*16);
|
||||||
|
//painter->drawChord(dx+dWidth-dHeight*0.5,dy,dHeight,dHeight,(-90)*16,180*16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
painter->drawEllipse(QPointF(dx+dWidth*0.5,dy+dHeight*0.5),dHeight*0.5,dHeight*0.5);
|
||||||
|
}*/
|
||||||
|
painter->drawText(QPointF(0,0),"yes");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
painter->drawText(QPointF(0,0),"no");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectricBaseModelSvgItem::loadSvg(const QString& str)
|
void ElectricBaseModelSvgItem::loadSvg(const QByteArray& data)
|
||||||
{
|
{
|
||||||
m_pRender = new QSvgRenderer(str);
|
m_pRender = new QSvgRenderer(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectricBaseModelSvgItem::move(const QPointF& point)
|
void ElectricBaseModelSvgItem::move(const QPointF& point)
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,10 @@ void DesignerScene::mousePressEvent(QGraphicsSceneMouseEvent* mouseEvent)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mousePressEvent(mouseEvent, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mousePressEvent(mouseEvent, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -84,9 +85,10 @@ void DesignerScene::mouseMoveEvent(QGraphicsSceneMouseEvent* mouseEvent)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mouseMoveEvent(mouseEvent, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mouseMoveEvent(mouseEvent, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -97,9 +99,10 @@ void DesignerScene::mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mouseReleaseEvent(mouseEvent, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mouseReleaseEvent(mouseEvent, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -110,9 +113,10 @@ void DesignerScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* mouseEvent)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mouseDoubleClickEvent(mouseEvent, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->mouseDoubleClickEvent(mouseEvent, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -133,9 +137,10 @@ void DesignerScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->contextMenuEvent(event, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->contextMenuEvent(event, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -146,9 +151,10 @@ void DesignerScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->dragEnterEvent(event, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->dragEnterEvent(event, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -159,9 +165,10 @@ void DesignerScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->dragMoveEvent(event, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->dragMoveEvent(event, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -172,9 +179,10 @@ void DesignerScene::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
if(m_pDrawingPanel->getMode() == DM_run)
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
|
if(mode == DM_run)
|
||||||
return;
|
return;
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->dropEvent(event, this);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->dropEvent(event, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,13 @@ DiagramCavas::~DiagramCavas()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawingPanel* DiagramCavas::getPanel(QString sPage)
|
||||||
|
{
|
||||||
|
if(m_mapDrawPanel.contains(sPage))
|
||||||
|
return m_mapDrawPanel[sPage].first;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void DiagramCavas::initial()
|
void DiagramCavas::initial()
|
||||||
{
|
{
|
||||||
//todo:读取数据并初始化
|
//todo:读取数据并初始化
|
||||||
|
|
@ -49,6 +56,7 @@ void DiagramCavas::onSignal_addDrawingPanel(PowerEntity* pItem,DiagramMode mode)
|
||||||
pPanel->show();
|
pPanel->show();
|
||||||
|
|
||||||
FixedPortsModel* pModel = pPanel->getModel();
|
FixedPortsModel* pModel = pPanel->getModel();
|
||||||
|
pModel->setCavas(this);
|
||||||
connect(pModel,&FixedPortsModel::activatePage,this,&DiagramCavas::onSignal_activatePage);
|
connect(pModel,&FixedPortsModel::activatePage,this,&DiagramCavas::onSignal_activatePage);
|
||||||
connect(pPanel,&DrawingPanel::panelDelete,this,&DiagramCavas::onSignal_panelDelete);
|
connect(pPanel,&DrawingPanel::panelDelete,this,&DiagramCavas::onSignal_panelDelete);
|
||||||
|
|
||||||
|
|
@ -336,6 +344,8 @@ void DiagramCavas::onCreateTestBaseModelDiagram()
|
||||||
pEntity = TopologyManager::instance().createDiagram(id.toString(),"测试1");
|
pEntity = TopologyManager::instance().createDiagram(id.toString(),"测试1");
|
||||||
|
|
||||||
onSignal_addDrawingPanel(pEntity,DM_baseModel);
|
onSignal_addDrawingPanel(pEntity,DM_baseModel);
|
||||||
|
DrawingPanel* pPanel = getPanel(pEntity->name());
|
||||||
|
pPanel->getModel()->addTestData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ DrawingPanel::DrawingPanel(PowerEntity* pEntity,QWidget *parent,DiagramMode mode
|
||||||
|
|
||||||
_pModel = new FixedPortsModel(pEntity);
|
_pModel = new FixedPortsModel(pEntity);
|
||||||
_pModel->setTopWidget(this);
|
_pModel->setTopWidget(this);
|
||||||
if(mode == DM_edit)
|
if(mode == DM_edit || mode == DM_baseModel)
|
||||||
m_pSelectorManager = new SelectorManager(_pModel,this);
|
m_pSelectorManager = new SelectorManager(_pModel,this);
|
||||||
m_pGraphicsScene = new DesignerScene(_pModel,this);
|
m_pGraphicsScene = new DesignerScene(_pModel,this);
|
||||||
//设置场景大小.前两个参数为scene的坐标远点,设置到view的中心点后,无论view如何缩放,secne的坐标原点都不会动,方便后续的位置计算
|
//设置场景大小.前两个参数为scene的坐标远点,设置到view的中心点后,无论view如何缩放,secne的坐标原点都不会动,方便后续的位置计算
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
#include "graphicsItem/electricSvgItemTriangle.h"
|
#include "graphicsItem/electricSvgItemTriangle.h"
|
||||||
#include "graphicsItem/electricConnectLineItem.h"
|
#include "graphicsItem/electricConnectLineItem.h"
|
||||||
#include "baseModelItem/electricBaseModelLineItem.h"
|
#include "baseModelItem/electricBaseModelLineItem.h"
|
||||||
|
#include "baseModelItem/electricBaseModelSvgItem.h"
|
||||||
|
#include "baseModelItem/electricBaseModelSvgBus.h"
|
||||||
|
#include "baseModelItem/electricBaseModelLineItem.h"
|
||||||
#include "graphicsItem/itemPort.h"
|
#include "graphicsItem/itemPort.h"
|
||||||
#include "designerScene.h"
|
#include "designerScene.h"
|
||||||
#include "dataBase.h"
|
#include "dataBase.h"
|
||||||
|
|
@ -15,9 +18,11 @@
|
||||||
#include "powerEntity.h"
|
#include "powerEntity.h"
|
||||||
#include "topologyManager.h"
|
#include "topologyManager.h"
|
||||||
#include "basePropertyManager.h"
|
#include "basePropertyManager.h"
|
||||||
|
#include "diagramCavas.h"
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "baseProperty.h"
|
#include "baseProperty.h"
|
||||||
|
#include "projectModelSetting.h"
|
||||||
|
|
||||||
bool FixedPortsModel::_dataInitialised = false;
|
bool FixedPortsModel::_dataInitialised = false;
|
||||||
|
|
||||||
|
|
@ -26,7 +31,9 @@ FixedPortsModel::FixedPortsModel(PowerEntity* pEntity)
|
||||||
,_widget(nullptr)
|
,_widget(nullptr)
|
||||||
,_Interface(nullptr)
|
,_Interface(nullptr)
|
||||||
,_pEntity(pEntity)
|
,_pEntity(pEntity)
|
||||||
|
,m_proModelSettingDlg(nullptr)
|
||||||
{
|
{
|
||||||
|
_cavas = nullptr;
|
||||||
loadNodeDataFromDataBase();
|
loadNodeDataFromDataBase();
|
||||||
_Interface = new HttpInterface(this);
|
_Interface = new HttpInterface(this);
|
||||||
_timer = new QTimer(this);
|
_timer = new QTimer(this);
|
||||||
|
|
@ -208,7 +215,10 @@ void FixedPortsModel::loadNodeDataFromDataBase()
|
||||||
QList<topologicInfo> lstTopo = DataBase::GetInstance()->getAllTopologics();
|
QList<topologicInfo> lstTopo = DataBase::GetInstance()->getAllTopologics();
|
||||||
for(auto &info:lstTopo)
|
for(auto &info:lstTopo)
|
||||||
{
|
{
|
||||||
TopologyManager::instance().createConnection(QString::number(info.id),info.from_pin.toString(),info.to_pin.toString(),info.uuid_from.toString(),info.uuid_to.toString());
|
QString from_pin = info.context["from_pin"].toString();
|
||||||
|
QString to_pin = info.context["to_pin"].toString();
|
||||||
|
|
||||||
|
TopologyManager::instance().createConnection(QString::number(info.id),from_pin,to_pin,info.uuid_from.toString(),info.uuid_to.toString());
|
||||||
}
|
}
|
||||||
_dataInitialised = true;
|
_dataInitialised = true;
|
||||||
}
|
}
|
||||||
|
|
@ -450,6 +460,9 @@ void FixedPortsModel::saveNode(int nPageId)
|
||||||
{
|
{
|
||||||
QString fromPin = con.nSrcPortId.toString();
|
QString fromPin = con.nSrcPortId.toString();
|
||||||
QString toPin = con.nDestPortId.toString();
|
QString toPin = con.nDestPortId.toString();
|
||||||
|
QJsonObject context;
|
||||||
|
context["from_pin"] = fromPin;
|
||||||
|
context["to_pin"] = toPin;
|
||||||
PowerConnection* pCon = TopologyManager::instance().connection(fromPin,toPin);
|
PowerConnection* pCon = TopologyManager::instance().connection(fromPin,toPin);
|
||||||
if(pCon)
|
if(pCon)
|
||||||
{
|
{
|
||||||
|
|
@ -462,7 +475,7 @@ void FixedPortsModel::saveNode(int nPageId)
|
||||||
TopologyManager::instance().removeConnection(pCon->id());
|
TopologyManager::instance().removeConnection(pCon->id());
|
||||||
break;
|
break;
|
||||||
case DataState::changed:
|
case DataState::changed:
|
||||||
DataBase::GetInstance()->insertTopologic(con.nSrcNodeId,con.nDestNodeId,con.nSrcPortId,con.nDestPortId,0,"",0);
|
DataBase::GetInstance()->insertTopologic(con.nSrcNodeId,con.nDestNodeId,context,0,"",0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -619,6 +632,89 @@ ElectricConnectLineItem* FixedPortsModel::getLineItemById(const QString& termina
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename TypeLine> void FixedPortsModel::establishConnection(GraphicsBaseItem* pSrc,GraphicsBaseItem* pDest,TypeLine* pItem)
|
||||||
|
{
|
||||||
|
ItemPort* pSrcPort = nullptr;
|
||||||
|
ItemPort* pDestPort = nullptr;
|
||||||
|
if(pSrc->getItemType() == GIT_baseBus)
|
||||||
|
{
|
||||||
|
int index = pSrc->addPort(p_movable,pSrc->mapFromScene(calculateBusPortPos(pSrc,pDest)));
|
||||||
|
createTopoTerminalsByItem(pSrc,ModelFunctionType::BaseModel);
|
||||||
|
pSrcPort = pSrc->getPortPtr(index);
|
||||||
|
|
||||||
|
QMap<QString,ItemPort*> mapPorts = pDest->getPorts();
|
||||||
|
|
||||||
|
for(auto& port:mapPorts)
|
||||||
|
{
|
||||||
|
if(port->getType() == T_lineIn)
|
||||||
|
{
|
||||||
|
pDestPort = port;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(pDest->getItemType() == GIT_baseBus)
|
||||||
|
{
|
||||||
|
int index = pDest->addPort(p_movable,pDest->mapFromScene(calculateBusPortPos(pDest,pSrc)));
|
||||||
|
createTopoTerminalsByItem(pDest,ModelFunctionType::BaseModel);
|
||||||
|
pDestPort = pDest->getPortPtr(index);
|
||||||
|
|
||||||
|
QMap<QString,ItemPort*> mapPorts = pSrc->getPorts();
|
||||||
|
|
||||||
|
for(auto& port:mapPorts)
|
||||||
|
{
|
||||||
|
if(port->getType() == T_lineOut)
|
||||||
|
{
|
||||||
|
pSrcPort = port;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMap<QString,ItemPort*> mapSrc = pSrc->getPorts();
|
||||||
|
pSrcPort = nullptr;
|
||||||
|
for(auto& port:mapSrc)
|
||||||
|
{
|
||||||
|
if(port->getType() == T_lineOut)
|
||||||
|
{
|
||||||
|
pSrcPort = port;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString,ItemPort*> mapDest = pDest->getPorts();
|
||||||
|
pDestPort = nullptr;
|
||||||
|
for(auto& port:mapDest)
|
||||||
|
{
|
||||||
|
if(port->getType() == T_lineIn)
|
||||||
|
{
|
||||||
|
pDestPort = port;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pSrcPort && pDestPort)
|
||||||
|
{
|
||||||
|
QPointF srcPortPos = pSrcPort->scenePos();
|
||||||
|
QPointF destPortPos = pDestPort->scenePos();
|
||||||
|
pItem->setStartPoint(srcPortPos);
|
||||||
|
pItem->setEndPoint(destPortPos);
|
||||||
|
pItem->calculatePath();
|
||||||
|
|
||||||
|
PowerConnection* pCon = TopologyManager::instance().createConnection(pItem->itemId().toString(),pSrcPort->getId(),pDestPort->getId(),pSrc->itemId().toString(),pDest->itemId().toString(),ModelFunctionType::BaseModel); //创建拓扑连接(逻辑)
|
||||||
|
if(pCon)
|
||||||
|
pCon->setState(DataState::changed);
|
||||||
|
pItem->setConnection(Connection(pSrc->itemId(),QUuid(pSrcPort->getId()),pSrcPort->getType(),pSrcPort->portPos(),pDest->itemId(),QUuid(pDestPort->getId()),pDestPort->getType(),pDestPort->portPos()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF FixedPortsModel::calculateBusPortPos(GraphicsBaseItem* pBus,GraphicsBaseItem* item)
|
||||||
|
{
|
||||||
|
return QPointF(item->pos().x(),pBus->pos().y());
|
||||||
|
}
|
||||||
|
|
||||||
void FixedPortsModel::showModelDlg(const QString& sName,QUuid uuid,GraphicsProjectModelItem* pItem)
|
void FixedPortsModel::showModelDlg(const QString& sName,QUuid uuid,GraphicsProjectModelItem* pItem)
|
||||||
{
|
{
|
||||||
modelStateInfo stateInfo = _modelStateInfo[sName];
|
modelStateInfo stateInfo = _modelStateInfo[sName];
|
||||||
|
|
@ -662,7 +758,7 @@ ConfigurationDiagram* FixedPortsModel::getTopologyDiagram()
|
||||||
return dynamic_cast<ConfigurationDiagram*>(_pEntity);
|
return dynamic_cast<ConfigurationDiagram*>(_pEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedPortsModel::createTopoTerminalsByItem(GraphicsBaseItem* pItem)
|
void FixedPortsModel::createTopoTerminalsByItem(GraphicsBaseItem* pItem,ModelFunctionType funType)
|
||||||
{
|
{
|
||||||
PowerEntity* pEntity = pItem->entity();
|
PowerEntity* pEntity = pItem->entity();
|
||||||
|
|
||||||
|
|
@ -687,12 +783,12 @@ void FixedPortsModel::createTopoTerminalsByItem(GraphicsBaseItem* pItem)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TopologyManager::instance().createTerminal(pEntity->id(),terType,"",port->pos(),port->getId());
|
TopologyManager::instance().createTerminal(pEntity->id(),terType,"",port->pos(),port->getId(),funType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedPortsModel::createTopoTerminalsByData(PowerEntity* pParent,QJsonObject componentCon)
|
void FixedPortsModel::createTopoTerminalsByData(PowerEntity* pParent,QJsonObject componentCon,ModelFunctionType funType)
|
||||||
{
|
{
|
||||||
QJsonArray portsArray = componentCon["port"].toArray();
|
QJsonArray portsArray = componentCon["port"].toArray();
|
||||||
for (QJsonValueRef portJson : portsArray) //每个属性的状态信息
|
for (QJsonValueRef portJson : portsArray) //每个属性的状态信息
|
||||||
|
|
@ -718,7 +814,7 @@ void FixedPortsModel::createTopoTerminalsByData(PowerEntity* pParent,QJsonObject
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TopologyManager::instance().createTerminal(pParent->id(),terType,"",QPointF(x,y),portId);
|
TopologyManager::instance().createTerminal(pParent->id(),terType,"",QPointF(x,y),portId,funType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -770,6 +866,17 @@ QMap<QUuid,QPointF> FixedPortsModel::allBaseNodePos() const
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FixedPortsModel::addBaseItem(QUuid uuid,GraphicsBaseModelItem* pItem)
|
||||||
|
{
|
||||||
|
if(_baseItem.contains(uuid))
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_baseItem.insert(uuid,pItem);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BaseModelProperty* FixedPortsModel::addBaseNodeData(QUuid id,int type,QString name,QString metaName)
|
BaseModelProperty* FixedPortsModel::addBaseNodeData(QUuid id,int type,QString name,QString metaName)
|
||||||
{
|
{
|
||||||
BaseModelProperty* pData = BasePropertyManager::instance().findBaseEntityData(id); //已存在不不创建
|
BaseModelProperty* pData = BasePropertyManager::instance().findBaseEntityData(id); //已存在不不创建
|
||||||
|
|
@ -789,3 +896,105 @@ BaseModelProperty* FixedPortsModel::addBaseNodeData(QUuid id,int type,QString na
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixedPortsModel::showProjectModelSettingDlg(GraphicsBaseModelItem* srcItem)
|
||||||
|
{
|
||||||
|
if(m_proModelSettingDlg == nullptr)
|
||||||
|
{
|
||||||
|
m_proModelSettingDlg = new ProjectModelSetting(_widget);
|
||||||
|
}
|
||||||
|
m_proModelSettingDlg->showDlg(srcItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedPortsModel::generateProjectModel(const QString& sPageName,QList<BaseModelProperty*> lstData)
|
||||||
|
{
|
||||||
|
DrawingPanel* pProPanel = nullptr;
|
||||||
|
if(_cavas){
|
||||||
|
DiagramInfo info;
|
||||||
|
info.id = QUuid::createUuid();
|
||||||
|
info.sName = sPageName;
|
||||||
|
info.sTag = sPageName;
|
||||||
|
info.sBasePageName = _pageName;
|
||||||
|
_cavas->onSignal_createDiagram(info);
|
||||||
|
pProPanel = _cavas->getPanel(sPageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto& pBase:lstData)
|
||||||
|
{
|
||||||
|
QUuid id = QUuid::createUuid();
|
||||||
|
BaseProperty* pData = addNodeData(id,pBase->type(),pBase->name(),pBase->modelName());
|
||||||
|
if(pData)
|
||||||
|
{
|
||||||
|
//pitem->setProperty(pData);
|
||||||
|
pData->setDataChanged(true); //数据状态改变
|
||||||
|
|
||||||
|
PowerEntity* pEntity = TopologyManager::instance().createEntity(EntityType::Component,id.toString(),pBase->name());
|
||||||
|
//if(pEntity)
|
||||||
|
//pitem->setEntity(pEntity);
|
||||||
|
//createTopoTerminalsByItem(pitem); //创建item对象的逻辑接线点
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedPortsModel::addTestData()
|
||||||
|
{
|
||||||
|
QUuid breakerId = QUuid::createUuid();
|
||||||
|
ElectricBaseModelSvgItem* pBreaker = new ElectricBaseModelSvgItem(QRect(-15, -15, 30, 30));
|
||||||
|
pBreaker->setItemId(breakerId);
|
||||||
|
pBreaker->setItemType(GIT_baseBreaker);
|
||||||
|
pBreaker->setInnerType(3);
|
||||||
|
pBreaker->initialPortsByDatabase();
|
||||||
|
QByteArray byte = DataBase::GetInstance()->ModelType()[3].icon;
|
||||||
|
pBreaker->loadSvg(byte);
|
||||||
|
PowerEntity* pEntityBreaker = TopologyManager::instance().createEntity(EntityType::Component,breakerId.toString(),"断路器1",ModelFunctionType::BaseModel);
|
||||||
|
if(pEntityBreaker)
|
||||||
|
pBreaker->setEntity(pEntityBreaker);
|
||||||
|
createTopoTerminalsByItem(pBreaker,ModelFunctionType::BaseModel);
|
||||||
|
BaseModelProperty* pBreakerData = addBaseNodeData(breakerId,3,"断路器1",DataBase::GetInstance()->ModelType()[3].modelType);
|
||||||
|
if(pBreakerData)
|
||||||
|
{
|
||||||
|
pBreaker->setProperty(pBreakerData);
|
||||||
|
pBreakerData->setDataChanged(true); //数据状态改变
|
||||||
|
}
|
||||||
|
addBaseItem(breakerId,pBreaker);
|
||||||
|
_scene->addItem(pBreaker);
|
||||||
|
pBreaker->setPos(QPointF(0,50));
|
||||||
|
|
||||||
|
|
||||||
|
QUuid busId = QUuid::createUuid();
|
||||||
|
ElectricBaseModelSvgBus* pBus = new ElectricBaseModelSvgBus(QRect(-200, -3, 400, 6));
|
||||||
|
pBus->setItemId(busId);
|
||||||
|
pBus->setItemType(GIT_baseBus);
|
||||||
|
pBus->setInnerType(1);
|
||||||
|
//pBreaker->initialPortsByDatabase();
|
||||||
|
QByteArray byte1 = DataBase::GetInstance()->ModelType()[1].icon;
|
||||||
|
pBus->loadSvg(byte1);
|
||||||
|
//createTopoTerminalsByItem(pBreaker);
|
||||||
|
BaseModelProperty* pBusData = addBaseNodeData(busId,1,"母线1",DataBase::GetInstance()->ModelType()[1].modelType);
|
||||||
|
if(pBusData)
|
||||||
|
{
|
||||||
|
pBus->setProperty(pBusData);
|
||||||
|
pBusData->setDataChanged(true); //数据状态改变
|
||||||
|
}
|
||||||
|
PowerEntity* pEntityBus = TopologyManager::instance().createEntity(EntityType::Component,breakerId.toString(),"母线1",ModelFunctionType::BaseModel);
|
||||||
|
if(pEntityBus)
|
||||||
|
pBus->setEntity(pEntityBus);
|
||||||
|
addBaseItem(busId,pBus);
|
||||||
|
_scene->addItem(pBus);
|
||||||
|
pBus->setPos(QPointF(0,150));
|
||||||
|
|
||||||
|
QUuid lineId = QUuid::createUuid();
|
||||||
|
ElectricBaseModelLineItem* pLine = new ElectricBaseModelLineItem();
|
||||||
|
pLine->setItemId(lineId);
|
||||||
|
pLine->setItemType(GIT_baseLine);
|
||||||
|
pLine->setInnerType(4);
|
||||||
|
BaseModelProperty* pLineData = addBaseNodeData(lineId,4,"电缆1",DataBase::GetInstance()->ModelType()[4].modelType);
|
||||||
|
if(pLineData)
|
||||||
|
{
|
||||||
|
pLine->setProperty(pLineData);
|
||||||
|
pLineData->setDataChanged(true); //数据状态改变
|
||||||
|
}
|
||||||
|
addBaseItem(lineId,pLine);
|
||||||
|
establishConnection(pBreaker,pBus,pLine);
|
||||||
|
_scene->addItem(pLine);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "graphicsItem/handleText.h"
|
#include "graphicsItem/handleText.h"
|
||||||
#include "graphicsItem/itemPort.h"
|
#include "graphicsItem/itemPort.h"
|
||||||
#include "baseProperty.h"
|
#include "baseProperty.h"
|
||||||
|
#include "dataBase.h"
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
@ -152,6 +153,28 @@ void GraphicsBaseItem::onUpdateData()
|
||||||
{
|
{
|
||||||
updateByProperty();
|
updateByProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsBaseItem::initialPortsByDatabase()
|
||||||
|
{
|
||||||
|
QMap<int,componentTypeInfo> mapType = DataBase::GetInstance()->getAllComponentType();
|
||||||
|
|
||||||
|
if(mapType.contains(m_inerType))
|
||||||
|
{
|
||||||
|
QJsonArray nodesJsonArray = mapType[m_inerType].config["port"].toArray();
|
||||||
|
|
||||||
|
for (QJsonValueRef nodeJson : nodesJsonArray)
|
||||||
|
{
|
||||||
|
QJsonObject node = nodeJson.toObject();
|
||||||
|
double dX = node["xRatio"].toDouble();
|
||||||
|
double dY = node["yRatio"].toDouble();
|
||||||
|
int movable = node["movable"].toInt();
|
||||||
|
int portType = node["portType"].toInt();
|
||||||
|
int portLocate = node["portLocate"].toInt();
|
||||||
|
|
||||||
|
addPort(PortState(movable),QPointF(boundingRect().left() + boundingRect().width() * dX, boundingRect().top()+boundingRect().height() *dY),QUuid::createUuid().toString(),HandleType(portType),PortPos(portLocate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/********************************基模****************************************/
|
/********************************基模****************************************/
|
||||||
GraphicsBaseModelItem::GraphicsBaseModelItem(QGraphicsItem *parent)
|
GraphicsBaseModelItem::GraphicsBaseModelItem(QGraphicsItem *parent)
|
||||||
:GraphicsBaseItem(parent)
|
:GraphicsBaseItem(parent)
|
||||||
|
|
@ -162,6 +185,16 @@ GraphicsBaseModelItem::~GraphicsBaseModelItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant GraphicsBaseModelItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value)
|
||||||
|
{
|
||||||
|
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||||
|
{
|
||||||
|
setHandleVisible(value.toBool());
|
||||||
|
}
|
||||||
|
return QGraphicsItem::itemChange(change, value);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************工程模**************************************/
|
/********************************工程模**************************************/
|
||||||
|
|
||||||
GraphicsProjectModelItem::GraphicsProjectModelItem(QGraphicsItem *parent)
|
GraphicsProjectModelItem::GraphicsProjectModelItem(QGraphicsItem *parent)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
#include "projectModelSetting.h"
|
||||||
|
#include "ui_projectModelSetting.h"
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
ProjectModelSetting::ProjectModelSetting(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
,ui(new Ui::projectModelSetting)
|
||||||
|
{
|
||||||
|
setWindowFlags(Qt::Widget);
|
||||||
|
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectModelSetting::~ProjectModelSetting()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectModelSetting::initial()
|
||||||
|
{
|
||||||
|
connect(ui->btn_ok,&QPushButton::clicked,this,&ProjectModelSetting::onOkClicked);
|
||||||
|
connect(ui->btn_cancel,&QPushButton::clicked,this,&ProjectModelSetting::onCancelClicked);
|
||||||
|
connect(ui->btn_saveAs,&QPushButton::clicked,this,&ProjectModelSetting::onSaveAsClicked);
|
||||||
|
|
||||||
|
connect(ui->btn_apply,&QPushButton::clicked,this,&ProjectModelSetting::onAddClicked);
|
||||||
|
connect(ui->btn_revoke,&QPushButton::clicked,this,&ProjectModelSetting::onDecreaseClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectModelSetting::showDlg(GraphicsBaseModelItem* srcNode)
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectModelSetting::onOkClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectModelSetting::onCancelClicked()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectModelSetting::onSaveAsClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectModelSetting::onAddClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectModelSetting::onDecreaseClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -30,398 +30,455 @@ BaseSelector::~BaseSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void BaseSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
if (event->button() != Qt::LeftButton)
|
if(sceneMode == DM_edit)
|
||||||
return;
|
|
||||||
|
|
||||||
_model->activateModel(); //激活当前窗口
|
|
||||||
ms_ptMouseDown = event->scenePos();
|
|
||||||
ms_ptMouseLast = event->scenePos();
|
|
||||||
|
|
||||||
if(!m_bHoverOnHandel)
|
|
||||||
scene->callParentEvent(event); //此处是通过触发QGraphicsScene的事件函数来取消所有被选中item的选中状态
|
|
||||||
|
|
||||||
m_opMode = OM_none;
|
|
||||||
|
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
|
||||||
if (items.count() == 1) //只有一个选中
|
|
||||||
{
|
{
|
||||||
GraphicsProjectModelItem* item = qgraphicsitem_cast<GraphicsProjectModelItem*>(items.first());
|
if (event->button() != Qt::LeftButton)
|
||||||
if(item)
|
|
||||||
{
|
|
||||||
GraphicsItemType tpe = item->getItemType();
|
|
||||||
if(tpe == GIT_link) //对象是连接线
|
|
||||||
{
|
|
||||||
m_opMode = OM_linkMove;
|
|
||||||
setCursor(scene, Qt::ArrowCursor);
|
|
||||||
emit setWorkingSelector(ST_linkMoving);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//需要增加当前是否点击在控制点的判断函数
|
|
||||||
ms_nDragHandle = item->collidesWithHandle(event->scenePos());
|
|
||||||
if(ms_nDragHandle != H_none && ms_nDragHandle <= H_left) //在缩放控制点上
|
|
||||||
{
|
|
||||||
m_opMode = OM_scale;
|
|
||||||
emit setWorkingSelector(ST_scaling);
|
|
||||||
}
|
|
||||||
else if(ms_nDragHandle >= H_rotate_leftTop && ms_nDragHandle <= H_rotate_leftBottom) //在旋转控制点上
|
|
||||||
{
|
|
||||||
m_opMode = OM_rotate;
|
|
||||||
//计算夹角
|
|
||||||
QPointF originPoint = item->mapToScene(item->boundingRect().center());
|
|
||||||
double dLengthY = ms_ptMouseLast.y() - originPoint.y();
|
|
||||||
double dLengthX = ms_ptMouseLast.x() - originPoint.x();
|
|
||||||
ms_dAngleMouseDownToItem = atan2(dLengthY, dLengthX) * 180 / M_PI;
|
|
||||||
// if(atan2(dLengthY, dLengthX) < 0)
|
|
||||||
// ms_dAngleMouseDownToItem += 360.0;
|
|
||||||
//创建副本
|
|
||||||
item->createOperationCopy();
|
|
||||||
emit setWorkingSelector(ST_rotation);
|
|
||||||
}
|
|
||||||
else if(ms_nDragHandle > H_rotate_leftBottom && ms_nDragHandle < H_textCaption) //编辑控制点上
|
|
||||||
{
|
|
||||||
m_opMode = OM_edit;
|
|
||||||
setCursor(scene, Qt::ClosedHandCursor);
|
|
||||||
emit setWorkingSelector(ST_editing);
|
|
||||||
}
|
|
||||||
else if(ms_nDragHandle >= H_connect ) //连接控制点
|
|
||||||
{
|
|
||||||
m_opMode = OM_connect;
|
|
||||||
//setCursor(scene, Qt::ClosedHandCursor);
|
|
||||||
setCursor(scene, Qt::ArrowCursor);
|
|
||||||
emit setWorkingSelector(ST_connecting);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_opMode = OM_move;
|
|
||||||
setCursor(scene, Qt::ClosedHandCursor);
|
|
||||||
emit setWorkingSelector(ST_moving);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (items.count() > 1) //选中多个
|
|
||||||
{
|
|
||||||
m_opMode = OM_move;
|
|
||||||
emit setWorkingSelector(ST_moving);
|
|
||||||
setCursor(scene, Qt::ClosedHandCursor);
|
|
||||||
}
|
|
||||||
else if(items.count() == 0) //单独移动子类
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem *> items = scene->items(ms_ptMouseLast);
|
|
||||||
if (items.count() == 1)
|
|
||||||
{
|
|
||||||
ItemControlHandle* pHandle = qgraphicsitem_cast<ItemControlHandle*>(items.first());
|
|
||||||
if(pHandle)
|
|
||||||
{
|
|
||||||
//GraphicsProjectModelItem* item = pHandle->getParentPtr();
|
|
||||||
ms_nDragHandle = pHandle->getTag();
|
|
||||||
//ms_nDragHandle = item->collidesWithHandle(event->scenePos());
|
|
||||||
if(ms_nDragHandle >= H_textCaption && ms_nDragHandle < H_connect) //移动文本
|
|
||||||
{
|
|
||||||
m_opMode = OM_subMove;
|
|
||||||
setCursor(scene, Qt::ClosedHandCursor);
|
|
||||||
emit setWorkingSelector(ST_subMoving);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_opMode == OM_move) //可以多个选中同时移动
|
|
||||||
{
|
|
||||||
for(int n = 0; n < items.size(); n++)
|
|
||||||
{
|
|
||||||
//创建副本
|
|
||||||
GraphicsProjectModelItem* item = qgraphicsitem_cast<GraphicsProjectModelItem*>(items.at(n));
|
|
||||||
GraphicsItemType tpe = item->getItemType();
|
|
||||||
if(tpe == GIT_link)
|
|
||||||
continue;
|
|
||||||
item->createOperationCopy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(m_opMode == OM_none)
|
|
||||||
{
|
|
||||||
QGraphicsView *view = scene->getView();
|
|
||||||
if(view)
|
|
||||||
view->setDragMode(QGraphicsView::RubberBandDrag);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
|
||||||
{
|
|
||||||
ms_ptMouseLast = event->scenePos();
|
|
||||||
|
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
|
||||||
|
|
||||||
if (items.count() == 1)
|
|
||||||
{
|
|
||||||
AbstractShape* item = qgraphicsitem_cast<AbstractShape*>(items.first());
|
|
||||||
if(item)
|
|
||||||
{
|
|
||||||
if(ms_nDragHandle == H_none)
|
|
||||||
{
|
|
||||||
//设置光标样式
|
|
||||||
int nHandle = item->collidesWithHandle(event->scenePos());
|
|
||||||
if(nHandle == H_none)
|
|
||||||
{
|
|
||||||
setCursor(scene, Qt::ArrowCursor);
|
|
||||||
m_bHoverOnHandel = false;
|
|
||||||
}
|
|
||||||
else if(nHandle >= H_edit)
|
|
||||||
{
|
|
||||||
setCursor(scene, Qt::OpenHandCursor);
|
|
||||||
m_bHoverOnHandel = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//划分为四组区间范围,分别水平组、垂直组、一三象限倾斜组、二四象限倾斜组,每组由两个对称区间构成
|
|
||||||
double dRotation = item->rotation();
|
|
||||||
dRotation += item->getSyncRotationDataFromParent();
|
|
||||||
//让角度保持在正负180的区间,也就是上下两个半圈,这样易于象限判断
|
|
||||||
if (dRotation > 180)
|
|
||||||
dRotation -= 360;
|
|
||||||
if (dRotation < -180)
|
|
||||||
dRotation += 360;
|
|
||||||
//qDebug() << "selfRotation:" << item->rotation() << " syncRotation:" << item->getSyncRotationDataFromParent() << " fininalRotatio:" << dRotation;
|
|
||||||
double dTileAngle = 15.0;
|
|
||||||
|
|
||||||
switch (nHandle)
|
|
||||||
{
|
|
||||||
case H_leftTop:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
else //水平区间
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_top:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
else
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_rightTop:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
else
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_right:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
else
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_rightBottom:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
else //水平区间
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_bottom:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
else
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_leftBottom:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
else //水平区间
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_left:
|
|
||||||
{
|
|
||||||
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
|
||||||
setCursor(scene, Qt::SizeVerCursor);
|
|
||||||
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeBDiagCursor);
|
|
||||||
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
|
||||||
setCursor(scene, Qt::SizeFDiagCursor);
|
|
||||||
else
|
|
||||||
setCursor(scene, Qt::SizeHorCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_rotate_leftTop:
|
|
||||||
{
|
|
||||||
int nSize = 24;
|
|
||||||
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
|
||||||
setCursor(scene, rotateCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_rotate_rightTop:
|
|
||||||
{
|
|
||||||
int nSize = 24;
|
|
||||||
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
|
||||||
setCursor(scene, rotateCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_rotate_rightBottom:
|
|
||||||
{
|
|
||||||
int nSize = 24;
|
|
||||||
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
|
||||||
setCursor(scene, rotateCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H_rotate_leftBottom:
|
|
||||||
{
|
|
||||||
int nSize = 24;
|
|
||||||
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
|
||||||
setCursor(scene, rotateCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_bHoverOnHandel = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
|
||||||
{
|
|
||||||
setCursor(scene, Qt::ArrowCursor);
|
|
||||||
|
|
||||||
if(m_opMode == OM_none)
|
|
||||||
{
|
|
||||||
QGraphicsView *view = scene->getView();
|
|
||||||
if(view)
|
|
||||||
view->setDragMode(QGraphicsView::NoDrag);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_opMode = OM_none;
|
|
||||||
m_bHoverOnHandel = false;
|
|
||||||
ms_nDragHandle = H_none;
|
|
||||||
scene->callParentEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseSelector::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
|
||||||
if(items.count() == 0)
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem *> items = scene->items(ms_ptMouseLast);
|
|
||||||
if (items.count() == 1)
|
|
||||||
{
|
|
||||||
ItemControlHandle* pHandle = qgraphicsitem_cast<ItemControlHandle*>(items.first());
|
|
||||||
if(pHandle)
|
|
||||||
{
|
|
||||||
ms_nDragHandle = pHandle->getTag();
|
|
||||||
//ms_nDragHandle = item->collidesWithHandle(event->scenePos());
|
|
||||||
if(ms_nDragHandle >= H_textCaption && ms_nDragHandle < H_connect) //是文字节点
|
|
||||||
{
|
|
||||||
HandleText* pText = qgraphicsitem_cast<HandleText*>(pHandle);
|
|
||||||
if(pText)
|
|
||||||
{
|
|
||||||
//m_opMode = OM_subMove;
|
|
||||||
//emit setWorkingSelector(ST_subMoving);
|
|
||||||
pText->creatEditor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(items.count() == 1) //不是文字节点
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseSelector::dragEnterEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*)
|
|
||||||
{
|
|
||||||
if (event->mimeData()->hasText()) {
|
|
||||||
event->acceptProposedAction();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseSelector::dragMoveEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*)
|
|
||||||
{
|
|
||||||
if (event->mimeData()->hasText()) {
|
|
||||||
event->acceptProposedAction();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseSelector::dropEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*)
|
|
||||||
{
|
|
||||||
if (event->mimeData()->hasText()) {
|
|
||||||
QString text = event->mimeData()->text();
|
|
||||||
QString uuid = QString::fromLocal8Bit(event->mimeData()->data("application/id"));
|
|
||||||
// 根据拖拽的数据创建相应的图形项并添加到场景中
|
|
||||||
QGraphicsTextItem *textItem = new QGraphicsTextItem(text);
|
|
||||||
textItem->setPos(event->scenePos());
|
|
||||||
//addItem(textItem);
|
|
||||||
event->acceptProposedAction();
|
|
||||||
|
|
||||||
//根据data数据新增拖拽的item
|
|
||||||
QMap<QUuid,GraphicsProjectModelItem*> items = _model->allItems();
|
|
||||||
if(items.contains(QUuid(uuid))){
|
|
||||||
QMessageBox::information(NULL, QString::fromWCharArray(L"提示"), QString::fromWCharArray(L"此对象在当前页已存在"));
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_model->activateModel(); //激活当前窗口
|
||||||
|
ms_ptMouseDown = event->scenePos();
|
||||||
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
|
if(!m_bHoverOnHandel)
|
||||||
|
scene->callParentEvent(event); //此处是通过触发QGraphicsScene的事件函数来取消所有被选中item的选中状态
|
||||||
|
|
||||||
|
m_opMode = OM_none;
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
if (items.count() == 1) //只有一个选中
|
||||||
|
{
|
||||||
|
GraphicsProjectModelItem* item = qgraphicsitem_cast<GraphicsProjectModelItem*>(items.first());
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
GraphicsItemType tpe = item->getItemType();
|
||||||
|
if(tpe == GIT_link) //对象是连接线
|
||||||
|
{
|
||||||
|
m_opMode = OM_linkMove;
|
||||||
|
setCursor(scene, Qt::ArrowCursor);
|
||||||
|
emit setWorkingSelector(ST_linkMoving);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//需要增加当前是否点击在控制点的判断函数
|
||||||
|
ms_nDragHandle = item->collidesWithHandle(event->scenePos());
|
||||||
|
if(ms_nDragHandle != H_none && ms_nDragHandle <= H_left) //在缩放控制点上
|
||||||
|
{
|
||||||
|
m_opMode = OM_scale;
|
||||||
|
emit setWorkingSelector(ST_scaling);
|
||||||
|
}
|
||||||
|
else if(ms_nDragHandle >= H_rotate_leftTop && ms_nDragHandle <= H_rotate_leftBottom) //在旋转控制点上
|
||||||
|
{
|
||||||
|
m_opMode = OM_rotate;
|
||||||
|
//计算夹角
|
||||||
|
QPointF originPoint = item->mapToScene(item->boundingRect().center());
|
||||||
|
double dLengthY = ms_ptMouseLast.y() - originPoint.y();
|
||||||
|
double dLengthX = ms_ptMouseLast.x() - originPoint.x();
|
||||||
|
ms_dAngleMouseDownToItem = atan2(dLengthY, dLengthX) * 180 / M_PI;
|
||||||
|
// if(atan2(dLengthY, dLengthX) < 0)
|
||||||
|
// ms_dAngleMouseDownToItem += 360.0;
|
||||||
|
//创建副本
|
||||||
|
item->createOperationCopy();
|
||||||
|
emit setWorkingSelector(ST_rotation);
|
||||||
|
}
|
||||||
|
else if(ms_nDragHandle > H_rotate_leftBottom && ms_nDragHandle < H_textCaption) //编辑控制点上
|
||||||
|
{
|
||||||
|
m_opMode = OM_edit;
|
||||||
|
setCursor(scene, Qt::ClosedHandCursor);
|
||||||
|
emit setWorkingSelector(ST_editing);
|
||||||
|
}
|
||||||
|
else if(ms_nDragHandle >= H_connect ) //连接控制点
|
||||||
|
{
|
||||||
|
m_opMode = OM_connect;
|
||||||
|
//setCursor(scene, Qt::ClosedHandCursor);
|
||||||
|
setCursor(scene, Qt::ArrowCursor);
|
||||||
|
emit setWorkingSelector(ST_connecting);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_opMode = OM_move;
|
||||||
|
setCursor(scene, Qt::ClosedHandCursor);
|
||||||
|
emit setWorkingSelector(ST_moving);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else if (items.count() > 1) //选中多个
|
||||||
_model->addNodeItem(QUuid(uuid),event->scenePos());
|
{
|
||||||
|
m_opMode = OM_move;
|
||||||
|
emit setWorkingSelector(ST_moving);
|
||||||
|
setCursor(scene, Qt::ClosedHandCursor);
|
||||||
|
}
|
||||||
|
else if(items.count() == 0) //单独移动子类
|
||||||
|
{
|
||||||
|
QList<QGraphicsItem *> items = scene->items(ms_ptMouseLast);
|
||||||
|
if (items.count() == 1)
|
||||||
|
{
|
||||||
|
ItemControlHandle* pHandle = qgraphicsitem_cast<ItemControlHandle*>(items.first());
|
||||||
|
if(pHandle)
|
||||||
|
{
|
||||||
|
//GraphicsProjectModelItem* item = pHandle->getParentPtr();
|
||||||
|
ms_nDragHandle = pHandle->getTag();
|
||||||
|
//ms_nDragHandle = item->collidesWithHandle(event->scenePos());
|
||||||
|
if(ms_nDragHandle >= H_textCaption && ms_nDragHandle < H_connect) //移动文本
|
||||||
|
{
|
||||||
|
m_opMode = OM_subMove;
|
||||||
|
setCursor(scene, Qt::ClosedHandCursor);
|
||||||
|
emit setWorkingSelector(ST_subMoving);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_opMode == OM_move) //可以多个选中同时移动
|
||||||
|
{
|
||||||
|
for(int n = 0; n < items.size(); n++)
|
||||||
|
{
|
||||||
|
//创建副本
|
||||||
|
GraphicsProjectModelItem* item = qgraphicsitem_cast<GraphicsProjectModelItem*>(items.at(n));
|
||||||
|
//GraphicsBaseModelItem* item = qgraphicsitem_cast<GraphicsBaseModelItem*>(items.at(n));
|
||||||
|
GraphicsItemType tpe = item->getItemType();
|
||||||
|
if(tpe == GIT_link)
|
||||||
|
continue;
|
||||||
|
item->createOperationCopy();
|
||||||
|
//item->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m_opMode == OM_none)
|
||||||
|
{
|
||||||
|
QGraphicsView *view = scene->getView();
|
||||||
|
if(view)
|
||||||
|
view->setDragMode(QGraphicsView::RubberBandDrag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(sceneMode == DM_baseModel)
|
||||||
|
{
|
||||||
|
_model->activateModel();
|
||||||
|
scene->callParentEvent(event);
|
||||||
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
if (items.count() == 1)
|
||||||
|
{
|
||||||
|
GraphicsBaseModelItem* item = qgraphicsitem_cast<GraphicsBaseModelItem*>(items.first());
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
item->setSelected(true);
|
||||||
|
item->updateHandles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseSelector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event,DesignerScene* scene)
|
void BaseSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
|
{
|
||||||
|
if(sceneMode == DM_edit)
|
||||||
|
{
|
||||||
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
|
||||||
|
if (items.count() == 1)
|
||||||
|
{
|
||||||
|
AbstractShape* item = qgraphicsitem_cast<AbstractShape*>(items.first());
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
if(ms_nDragHandle == H_none)
|
||||||
|
{
|
||||||
|
//设置光标样式
|
||||||
|
int nHandle = item->collidesWithHandle(event->scenePos());
|
||||||
|
if(nHandle == H_none)
|
||||||
|
{
|
||||||
|
setCursor(scene, Qt::ArrowCursor);
|
||||||
|
m_bHoverOnHandel = false;
|
||||||
|
}
|
||||||
|
else if(nHandle >= H_edit)
|
||||||
|
{
|
||||||
|
setCursor(scene, Qt::OpenHandCursor);
|
||||||
|
m_bHoverOnHandel = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//划分为四组区间范围,分别水平组、垂直组、一三象限倾斜组、二四象限倾斜组,每组由两个对称区间构成
|
||||||
|
double dRotation = item->rotation();
|
||||||
|
dRotation += item->getSyncRotationDataFromParent();
|
||||||
|
//让角度保持在正负180的区间,也就是上下两个半圈,这样易于象限判断
|
||||||
|
if (dRotation > 180)
|
||||||
|
dRotation -= 360;
|
||||||
|
if (dRotation < -180)
|
||||||
|
dRotation += 360;
|
||||||
|
//qDebug() << "selfRotation:" << item->rotation() << " syncRotation:" << item->getSyncRotationDataFromParent() << " fininalRotatio:" << dRotation;
|
||||||
|
double dTileAngle = 15.0;
|
||||||
|
|
||||||
|
switch (nHandle)
|
||||||
|
{
|
||||||
|
case H_leftTop:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
else //水平区间
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_top:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
else
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_rightTop:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
else
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_right:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
else
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_rightBottom:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
else //水平区间
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_bottom:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
else
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_leftBottom:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
else //水平区间
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_left:
|
||||||
|
{
|
||||||
|
if((dRotation > -145+dTileAngle && dRotation < -45-dTileAngle) || (dRotation > 45+dTileAngle && dRotation < 145-dTileAngle)) //垂直区间
|
||||||
|
setCursor(scene, Qt::SizeVerCursor);
|
||||||
|
else if((dRotation >= -45-dTileAngle && dRotation <= -45+dTileAngle) || (dRotation >= 145-dTileAngle && dRotation <= 145+dTileAngle)) //一三象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeBDiagCursor);
|
||||||
|
else if((dRotation >= -145-dTileAngle && dRotation <= -145+dTileAngle) || (dRotation >= 45-dTileAngle && dRotation <= 45+dTileAngle)) //二四象限倾斜
|
||||||
|
setCursor(scene, Qt::SizeFDiagCursor);
|
||||||
|
else
|
||||||
|
setCursor(scene, Qt::SizeHorCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_rotate_leftTop:
|
||||||
|
{
|
||||||
|
int nSize = 24;
|
||||||
|
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
||||||
|
setCursor(scene, rotateCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_rotate_rightTop:
|
||||||
|
{
|
||||||
|
int nSize = 24;
|
||||||
|
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
||||||
|
setCursor(scene, rotateCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_rotate_rightBottom:
|
||||||
|
{
|
||||||
|
int nSize = 24;
|
||||||
|
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
||||||
|
setCursor(scene, rotateCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case H_rotate_leftBottom:
|
||||||
|
{
|
||||||
|
int nSize = 24;
|
||||||
|
QCursor rotateCursor = QCursor(QPixmap(":/images/icon_rotate.png")/*.scaled(nSize, nSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)*/);
|
||||||
|
setCursor(scene, rotateCursor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bHoverOnHandel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(sceneMode == DM_baseModel)
|
||||||
|
{
|
||||||
|
int a = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
|
{
|
||||||
|
if(sceneMode == DM_edit)
|
||||||
|
{
|
||||||
|
setCursor(scene, Qt::ArrowCursor);
|
||||||
|
|
||||||
|
if(m_opMode == OM_none)
|
||||||
|
{
|
||||||
|
QGraphicsView *view = scene->getView();
|
||||||
|
if(view)
|
||||||
|
view->setDragMode(QGraphicsView::NoDrag);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_opMode = OM_none;
|
||||||
|
m_bHoverOnHandel = false;
|
||||||
|
ms_nDragHandle = H_none;
|
||||||
|
scene->callParentEvent(event);
|
||||||
|
}
|
||||||
|
else if(sceneMode == DM_baseModel)
|
||||||
|
{
|
||||||
|
m_opMode = OM_none;
|
||||||
|
scene->callParentEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseSelector::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
|
{
|
||||||
|
if(sceneMode == DM_edit)
|
||||||
|
{
|
||||||
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
if(items.count() == 0)
|
||||||
|
{
|
||||||
|
QList<QGraphicsItem *> items = scene->items(ms_ptMouseLast);
|
||||||
|
if (items.count() == 1)
|
||||||
|
{
|
||||||
|
ItemControlHandle* pHandle = qgraphicsitem_cast<ItemControlHandle*>(items.first());
|
||||||
|
if(pHandle)
|
||||||
|
{
|
||||||
|
ms_nDragHandle = pHandle->getTag();
|
||||||
|
//ms_nDragHandle = item->collidesWithHandle(event->scenePos());
|
||||||
|
if(ms_nDragHandle >= H_textCaption && ms_nDragHandle < H_connect) //是文字节点
|
||||||
|
{
|
||||||
|
HandleText* pText = qgraphicsitem_cast<HandleText*>(pHandle);
|
||||||
|
if(pText)
|
||||||
|
{
|
||||||
|
//m_opMode = OM_subMove;
|
||||||
|
//emit setWorkingSelector(ST_subMoving);
|
||||||
|
pText->creatEditor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(items.count() == 1) //不是文字节点
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(sceneMode == DM_baseModel)
|
||||||
|
{
|
||||||
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
if(items.count() == 1)
|
||||||
|
{
|
||||||
|
GraphicsBaseModelItem* item = qgraphicsitem_cast<GraphicsBaseModelItem*>(items.first());
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
_model->showProjectModelSettingDlg(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseSelector::dragEnterEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*,DiagramMode sceneMode)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasText()) {
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseSelector::dragMoveEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*,DiagramMode sceneMode)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasText()) {
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseSelector::dropEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*,DiagramMode sceneMode)
|
||||||
|
{
|
||||||
|
if(sceneMode == DM_edit)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasText()) {
|
||||||
|
QString text = event->mimeData()->text();
|
||||||
|
QString uuid = QString::fromLocal8Bit(event->mimeData()->data("application/id"));
|
||||||
|
// 根据拖拽的数据创建相应的图形项并添加到场景中
|
||||||
|
QGraphicsTextItem *textItem = new QGraphicsTextItem(text);
|
||||||
|
textItem->setPos(event->scenePos());
|
||||||
|
//addItem(textItem);
|
||||||
|
event->acceptProposedAction();
|
||||||
|
|
||||||
|
//根据data数据新增拖拽的item
|
||||||
|
QMap<QUuid,GraphicsProjectModelItem*> items = _model->allItems();
|
||||||
|
if(items.contains(QUuid(uuid))){
|
||||||
|
QMessageBox::information(NULL, QString::fromWCharArray(L"提示"), QString::fromWCharArray(L"此对象在当前页已存在"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
_model->addNodeItem(QUuid(uuid),event->scenePos());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(sceneMode == DM_baseModel)
|
||||||
|
{
|
||||||
|
int a = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseSelector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event,DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem*> listItem = scene->selectedItems();
|
QList<QGraphicsItem*> listItem = scene->selectedItems();
|
||||||
if(listItem.isEmpty())
|
if(listItem.isEmpty())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ ConnectingSelector::~ConnectingSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void ConnectingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ void ConnectingSelector::createConnectLline(GraphicsProjectModelItem* connecting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void ConnectingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
if(m_pConnectingItem == nullptr)
|
if(m_pConnectingItem == nullptr)
|
||||||
|
|
@ -212,7 +212,7 @@ void ConnectingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, Designe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void ConnectingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
if(m_bReadyConnect)
|
if(m_bReadyConnect)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ CreatingSelector::~CreatingSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void CreatingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
if (event->button() != Qt::LeftButton)
|
if (event->button() != Qt::LeftButton)
|
||||||
return;
|
return;
|
||||||
|
|
@ -123,7 +123,7 @@ void CreatingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, Designer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void CreatingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
setCursor(scene, Qt::CrossCursor);
|
setCursor(scene, Qt::CrossCursor);
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
@ -159,7 +159,7 @@ void CreatingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void CreatingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
if (m_pCreatingItem && m_creatingMethod == CM_drag)
|
if (m_pCreatingItem && m_creatingMethod == CM_drag)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,12 @@ EditingSelector::~EditingSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void EditingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void EditingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
|
@ -35,7 +35,7 @@ void EditingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerSc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void EditingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
if (items.count() == 1)
|
if (items.count() == 1)
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ LinkMovingSelector::~LinkMovingSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkMovingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void LinkMovingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
//QList<QGraphicsItem *> items = scene->selectedItems();
|
//QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkMovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void LinkMovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ void LinkMovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, Designe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkMovingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void LinkMovingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
if(m_pMovingLine)
|
if(m_pMovingLine)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ MovingSelector::~MovingSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void MovingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ void MovingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerSc
|
||||||
updateConnectLineByTopology(items);
|
updateConnectLineByTopology(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void MovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ void MovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerSce
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void MovingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
for(int n = 0; n < items.size(); n++)
|
for(int n = 0; n < items.size(); n++)
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ RotationSelector::~RotationSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RotationSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void RotationSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RotationSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void RotationSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
|
@ -49,7 +49,7 @@ void RotationSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RotationSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void RotationSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
for(int n = 0; n < items.size(); n++)
|
for(int n = 0; n < items.size(); n++)
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ ScalingSelector::~ScalingSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScalingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void ScalingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
BaseSelector::mousePressEvent(event,scene);
|
BaseSelector::mousePressEvent(event,scene,sceneMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScalingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void ScalingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
|
@ -51,7 +51,7 @@ void ScalingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerSc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScalingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void ScalingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
if (items.count() == 1)
|
if (items.count() == 1)
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ SubMovingSelector::~SubMovingSelector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubMovingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void SubMovingSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
|
|
||||||
QList<QGraphicsItem *> items = scene->selectedItems();
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubMovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void SubMovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
ms_ptMouseLast = event->scenePos();
|
ms_ptMouseLast = event->scenePos();
|
||||||
if(m_pParentItem == nullptr)
|
if(m_pParentItem == nullptr)
|
||||||
|
|
@ -62,7 +62,7 @@ void SubMovingSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, Designer
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubMovingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene)
|
void SubMovingSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
m_pParentItem = nullptr;
|
m_pParentItem = nullptr;
|
||||||
ms_nDragHandle = H_none;
|
ms_nDragHandle = H_none;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,339 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>projectModelSetting</class>
|
||||||
|
<widget class="QDialog" name="projectModelSetting">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>634</width>
|
||||||
|
<height>596</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>4</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="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(177, 177, 177);</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>6</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="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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>基础设置</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>基本信息</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,1,0,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>元件名称:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="le_name">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>基模类型:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="le_base">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>当前工程模:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cb_modelType"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>属性信息</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">font: 12pt "Microsoft YaHei UI";
|
||||||
|
color: rgb(8, 8, 8);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>元模型属性</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">font: 12pt "Microsoft YaHei UI";
|
||||||
|
color: rgb(8, 8, 8);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>工程模型属性</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" rowspan="4">
|
||||||
|
<widget class="QTreeView" name="treeView_base">
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>158</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" rowspan="4">
|
||||||
|
<widget class="QTreeView" name="treeView_sub">
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="btn_apply">
|
||||||
|
<property name="text">
|
||||||
|
<string>>></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="btn_revoke">
|
||||||
|
<property name="text">
|
||||||
|
<string><<</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>158</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>其他设置</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>工程图标设置</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget_icon">
|
||||||
|
<property name="viewMode">
|
||||||
|
<enum>QListView::ViewMode::IconMode</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>244</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_saveAs">
|
||||||
|
<property name="text">
|
||||||
|
<string>工程模另存为</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="le_saveAs">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>180</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>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -30,7 +30,7 @@ public:
|
||||||
bool insertStation(int zoneId,QString name,QString description,bool isLocal,int op);
|
bool insertStation(int zoneId,QString name,QString description,bool isLocal,int op);
|
||||||
bool insertGrid(QString name,QString description,int op);
|
bool insertGrid(QString name,QString description,int op);
|
||||||
bool insertZone(int grid_id,QString name,QString description,int op);
|
bool insertZone(int grid_id,QString name,QString description,int op);
|
||||||
bool insertTopologic(QUuid uuid_from,QUuid uuid_to,QUuid from_pin,QUuid to_pin,int flag,QString description,int op);
|
bool insertTopologic(QUuid uuid_from,QUuid uuid_to,QJsonObject context,int flag,QString description,int op);
|
||||||
|
|
||||||
QString getGridNameById(int);
|
QString getGridNameById(int);
|
||||||
QString getZoneNameById(int);
|
QString getZoneNameById(int);
|
||||||
|
|
@ -54,6 +54,7 @@ public:
|
||||||
bool componentExist(QString uuid);
|
bool componentExist(QString uuid);
|
||||||
bool deleteComponent(QString uuid);
|
bool deleteComponent(QString uuid);
|
||||||
|
|
||||||
|
QMap<int,componentTypeInfo> getAllComponentType(); //获取所有支持的元件种类
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
int getPageIdByName(QString name);
|
int getPageIdByName(QString name);
|
||||||
bool updatePage(QString tag,QString name,QJsonObject context);
|
bool updatePage(QString tag,QString name,QJsonObject context);
|
||||||
|
|
@ -119,6 +120,8 @@ private:
|
||||||
QMap<int,modelAttribute> _modelAttribute; //模型-属性对照组
|
QMap<int,modelAttribute> _modelAttribute; //模型-属性对照组
|
||||||
QMap<int,modelAttributePublic> _modelAttributePublic; //公共属性组
|
QMap<int,modelAttributePublic> _modelAttributePublic; //公共属性组
|
||||||
QMap<int,modelConnectivity> _modelConnectivity; //连接性组
|
QMap<int,modelConnectivity> _modelConnectivity; //连接性组
|
||||||
|
|
||||||
|
QMap<int,componentTypeInfo> _componentType; //存储系统支持的类型列表
|
||||||
private:
|
private:
|
||||||
void initial();
|
void initial();
|
||||||
//bool createProjectDB();
|
//bool createProjectDB();
|
||||||
|
|
|
||||||
|
|
@ -455,20 +455,22 @@ bool DataBase::insertZone(int grid_id,QString name,QString description,int op)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataBase::insertTopologic(QUuid uuid_from,QUuid uuid_to,QUuid from_pin,QUuid to_pin,int flag,QString description,int op)
|
bool DataBase::insertTopologic(QUuid uuid_from,QUuid uuid_to,QJsonObject context,int flag,QString description,int op)
|
||||||
{
|
{
|
||||||
|
QJsonDocument contextDoc(context);
|
||||||
|
QString strContext = contextDoc.toJson(QJsonDocument::Compact);
|
||||||
|
|
||||||
if(db.open())
|
if(db.open())
|
||||||
{
|
{
|
||||||
QSqlQuery qry(db);
|
QSqlQuery qry(db);
|
||||||
qry.prepare("INSERT INTO topologic(uuid_from, uuid_to, from_pin, to_pin, flag, description, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
|
qry.prepare("INSERT INTO topologic(uuid_from, uuid_to, context, flag, description, op, ts) VALUES (?, ?, ?, ?, ?, ?, ?);");
|
||||||
qry.bindValue(0,uuid_from);
|
qry.bindValue(0,uuid_from);
|
||||||
qry.bindValue(1,uuid_to);
|
qry.bindValue(1,uuid_to);
|
||||||
qry.bindValue(2,from_pin);
|
qry.bindValue(2,strContext);
|
||||||
qry.bindValue(3,to_pin);
|
qry.bindValue(3,flag);
|
||||||
qry.bindValue(4,flag);
|
qry.bindValue(4,description);
|
||||||
qry.bindValue(5,description);
|
qry.bindValue(5,op);
|
||||||
qry.bindValue(6,op);
|
qry.bindValue(6,QDateTime::currentDateTime());
|
||||||
qry.bindValue(7,QDateTime::currentDateTime());
|
|
||||||
bool res = qry.exec();
|
bool res = qry.exec();
|
||||||
QString str = qry.lastQuery();
|
QString str = qry.lastQuery();
|
||||||
if(!res)
|
if(!res)
|
||||||
|
|
@ -632,7 +634,7 @@ QList<stationInfo> DataBase::getAllStation()
|
||||||
QList<topologicInfo> DataBase::getAllTopologics()
|
QList<topologicInfo> DataBase::getAllTopologics()
|
||||||
{
|
{
|
||||||
QList<topologicInfo> lst;
|
QList<topologicInfo> lst;
|
||||||
QString strSQL = "SELECT id,uuid_from,uuid_to,from_pin,to_pin,flag FROM topologic";
|
QString strSQL = "SELECT id,uuid_from,uuid_to,context,flag FROM topologic";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -643,9 +645,9 @@ QList<topologicInfo> DataBase::getAllTopologics()
|
||||||
info.id = query.value(0).toInt();
|
info.id = query.value(0).toInt();
|
||||||
info.uuid_from = QUuid(query.value(1).toString());
|
info.uuid_from = QUuid(query.value(1).toString());
|
||||||
info.uuid_to = QUuid(query.value(2).toString());
|
info.uuid_to = QUuid(query.value(2).toString());
|
||||||
info.from_pin = QUuid(query.value(3).toString());
|
QString str = query.value(3).toString();
|
||||||
info.to_pin = QUuid(query.value(4).toString());
|
info.context = QstringToJson(str);
|
||||||
info.flag = query.value(5).toInt();
|
info.flag = query.value(4).toInt();
|
||||||
|
|
||||||
lst.append(info);
|
lst.append(info);
|
||||||
}
|
}
|
||||||
|
|
@ -685,7 +687,7 @@ int DataBase::topologicExist(QUuid fromPin,QUuid toPin)
|
||||||
topologicInfo DataBase::getTopologicById(int id)
|
topologicInfo DataBase::getTopologicById(int id)
|
||||||
{
|
{
|
||||||
topologicInfo info;
|
topologicInfo info;
|
||||||
QString strSQL = "SELECT id,uuid_from,uuid_to,from_pin,to_pin,flag FROM topologic WHERE id = ?";
|
QString strSQL = "SELECT id,uuid_from,uuid_to,context,flag FROM topologic WHERE id = ?";
|
||||||
QVariantList params;
|
QVariantList params;
|
||||||
params.append(id);
|
params.append(id);
|
||||||
|
|
||||||
|
|
@ -697,9 +699,9 @@ topologicInfo DataBase::getTopologicById(int id)
|
||||||
info.id = query.value(0).toInt();
|
info.id = query.value(0).toInt();
|
||||||
info.uuid_from = QUuid(query.value(1).toString());
|
info.uuid_from = QUuid(query.value(1).toString());
|
||||||
info.uuid_to = QUuid(query.value(2).toString());
|
info.uuid_to = QUuid(query.value(2).toString());
|
||||||
info.from_pin = QUuid(query.value(3).toString());
|
QString str = query.value(3).toString();
|
||||||
info.to_pin = QUuid(query.value(4).toString());
|
info.context = QstringToJson(str);
|
||||||
info.flag = query.value(5).toInt();
|
info.flag = query.value(4).toInt();
|
||||||
}
|
}
|
||||||
query.clear();
|
query.clear();
|
||||||
return info;
|
return info;
|
||||||
|
|
@ -857,6 +859,43 @@ bool DataBase::deleteComponent(QString uuid)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<int,componentTypeInfo> DataBase::getAllComponentType()
|
||||||
|
{
|
||||||
|
if(_componentType.empty())
|
||||||
|
{
|
||||||
|
QMap<int,componentTypeInfo> map;
|
||||||
|
if(db.open())
|
||||||
|
{
|
||||||
|
QSqlQuery qry(db);
|
||||||
|
|
||||||
|
qry.prepare("SELECT id, type, name, config FROM component_type");
|
||||||
|
bool res = qry.exec();
|
||||||
|
QString str = qry.lastQuery();
|
||||||
|
if(!res)
|
||||||
|
{
|
||||||
|
qDebug()<<str<<"\n"<<qry.lastError().text();
|
||||||
|
qry.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (qry.next())
|
||||||
|
{
|
||||||
|
componentTypeInfo inf;
|
||||||
|
inf.id = qry.value(0).toInt();
|
||||||
|
inf.type = qry.value(1).toString();
|
||||||
|
inf.name = qry.value(2).toString();
|
||||||
|
QString str = qry.value(3).toString();
|
||||||
|
inf.config = QstringToJson(str);
|
||||||
|
map.insert(inf.id,inf);
|
||||||
|
}
|
||||||
|
qry.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_componentType = map;
|
||||||
|
}
|
||||||
|
return _componentType;
|
||||||
|
}
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
|
|
||||||
bool DataBase::updatePage(QString tag,QString name,QJsonObject context)
|
bool DataBase::updatePage(QString tag,QString name,QJsonObject context)
|
||||||
|
|
@ -1174,7 +1213,7 @@ bool DataBase::getDataType()
|
||||||
|
|
||||||
bool DataBase::getModelType()
|
bool DataBase::getModelType()
|
||||||
{
|
{
|
||||||
QString strSQL = "SELECT * FROM basic.model_type";
|
QString strSQL = "SELECT id, model_type, model_name, graphic_element, icon, remark FROM basic.model_type";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -1184,7 +1223,9 @@ bool DataBase::getModelType()
|
||||||
int id = query.value(0).toInt();
|
int id = query.value(0).toInt();
|
||||||
QString sModelType = query.value(1).toString(); //模型类型
|
QString sModelType = query.value(1).toString(); //模型类型
|
||||||
QString sModelName = query.value(2).toString(); //模型名称
|
QString sModelName = query.value(2).toString(); //模型名称
|
||||||
QString remark = query.value(3).toString(); //备注
|
int graphicElement = query.value(3).toInt();
|
||||||
|
QByteArray bIcon = query.value(4).toByteArray(); //图片
|
||||||
|
QString remark = query.value(5).toString(); //备注
|
||||||
|
|
||||||
if(!_modelType.contains(id))
|
if(!_modelType.contains(id))
|
||||||
{
|
{
|
||||||
|
|
@ -1192,6 +1233,8 @@ bool DataBase::getModelType()
|
||||||
mt.id = id;
|
mt.id = id;
|
||||||
mt.modelType = sModelType;
|
mt.modelType = sModelType;
|
||||||
mt.modelName = sModelName;
|
mt.modelName = sModelName;
|
||||||
|
mt.graphicEelement = graphicElement;
|
||||||
|
mt.icon = bIcon;
|
||||||
mt.remark = remark;
|
mt.remark = remark;
|
||||||
|
|
||||||
_modelType.insert(id,mt);
|
_modelType.insert(id,mt);
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,9 @@ void CMainWindow::initializeAction()
|
||||||
|
|
||||||
QAction* actEditBay = ui->menuBay->addAction(QString::fromWCharArray(L"编辑间隔"));
|
QAction* actEditBay = ui->menuBay->addAction(QString::fromWCharArray(L"编辑间隔"));
|
||||||
connect(actEditBay,&QAction::triggered,this,&CMainWindow::onAction_editBay);
|
connect(actEditBay,&QAction::triggered,this,&CMainWindow::onAction_editBay);
|
||||||
|
|
||||||
|
QAction* testAct = ui->menuTest->addAction(QString::fromWCharArray(L"生成测试基模"));
|
||||||
|
connect(testAct,&QAction::triggered,m_pDiagramCavas,&DiagramCavas::onCreateTestBaseModelDiagram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::onAction_zoomIn()
|
void CMainWindow::onAction_zoomIn()
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,17 @@
|
||||||
<string>间隔管理</string>
|
<string>间隔管理</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuTest">
|
||||||
|
<property name="title">
|
||||||
|
<string>测试</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuView"/>
|
<addaction name="menuView"/>
|
||||||
<addaction name="menuMode"/>
|
<addaction name="menuMode"/>
|
||||||
<addaction name="menuProject"/>
|
<addaction name="menuProject"/>
|
||||||
<addaction name="menuBay"/>
|
<addaction name="menuBay"/>
|
||||||
|
<addaction name="menuTest"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue