add custom HMI generate UI
This commit is contained in:
parent
efa6593a17
commit
8b5be362ae
|
|
@ -191,8 +191,8 @@ add_subdirectory(diagramUtils)
|
||||||
add_subdirectory(diagramCommunication)
|
add_subdirectory(diagramCommunication)
|
||||||
add_subdirectory(pluginManager)
|
add_subdirectory(pluginManager)
|
||||||
|
|
||||||
target_link_libraries(DiagramDesigner PRIVATE PropertyEditor)
|
target_link_libraries(DiagramDesigner PUBLIC PropertyEditor)
|
||||||
target_link_libraries(DiagramDesigner PRIVATE diagramCavas diagramUtils diagramCommunication pluginManager)
|
target_link_libraries(DiagramDesigner PUBLIC diagramCavas diagramUtils diagramCommunication pluginManager)
|
||||||
|
|
||||||
file(COPY setting.xml DESTINATION "${CMAKE_BINARY_DIR}/${dd_PlatformDir}/bin")
|
file(COPY setting.xml DESTINATION "${CMAKE_BINARY_DIR}/${dd_PlatformDir}/bin")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QTimer>
|
||||||
#include "QQuickDetailsViewMananger.h"
|
#include "QQuickDetailsViewMananger.h"
|
||||||
|
|
||||||
QDetailsView::QDetailsView(QWidget* parent)
|
QDetailsView::QDetailsView(QWidget* parent)
|
||||||
|
|
@ -70,10 +71,21 @@ QQuickDetailsView* QDetailsView::getQuickDetailsView() const
|
||||||
|
|
||||||
void QDetailsView::setObject(QObject* inObject)
|
void QDetailsView::setObject(QObject* inObject)
|
||||||
{
|
{
|
||||||
|
if (!mQuickWidget) return;
|
||||||
|
|
||||||
QQuickItem* rootObject = mQuickWidget->rootObject();
|
QQuickItem* rootObject = mQuickWidget->rootObject();
|
||||||
if (rootObject) {
|
if (!rootObject) return;
|
||||||
rootObject->setProperty("Object", QVariant::fromValue(inObject));
|
|
||||||
|
// ✅ 安全处理nullptr
|
||||||
|
if (!inObject) {
|
||||||
|
// 设置一个表示"空"的特殊值
|
||||||
|
QVariant emptyVar = QVariant::fromValue<QObject*>(nullptr);
|
||||||
|
rootObject->setProperty("Object", emptyVar);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置普通对象
|
||||||
|
rootObject->setProperty("Object", QVariant::fromValue(inObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* QDetailsView::getObject() const
|
QObject* QDetailsView::getObject() const
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,8 @@ void QPropertyHandle::resloveMetaData()
|
||||||
|
|
||||||
QPropertyHandle* QPropertyHandle::Find(const QObject* inParent, const QString& inPropertyPath)
|
QPropertyHandle* QPropertyHandle::Find(const QObject* inParent, const QString& inPropertyPath)
|
||||||
{
|
{
|
||||||
|
if(!inParent)
|
||||||
|
return nullptr;
|
||||||
for (QObject* child : inParent->children()) {
|
for (QObject* child : inParent->children()) {
|
||||||
QPropertyHandle* handler = qobject_cast<QPropertyHandle*>(child);
|
QPropertyHandle* handler = qobject_cast<QPropertyHandle*>(child);
|
||||||
if (handler && handler->getPropertyPath() == inPropertyPath) {
|
if (handler && handler->getPropertyPath() == inPropertyPath) {
|
||||||
|
|
@ -90,6 +92,8 @@ QPropertyHandle* QPropertyHandle::FindOrCreate(QObject* inParent, QMetaType inTy
|
||||||
|
|
||||||
QPropertyHandle* QPropertyHandle::FindOrCreate(QObject* inObject)
|
QPropertyHandle* QPropertyHandle::FindOrCreate(QObject* inObject)
|
||||||
{
|
{
|
||||||
|
if(!inObject)
|
||||||
|
return nullptr;
|
||||||
QPropertyHandle* handle = Find(inObject, "");
|
QPropertyHandle* handle = Find(inObject, "");
|
||||||
if (handle)
|
if (handle)
|
||||||
return handle;
|
return handle;
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,9 @@ enum DiagramMode {
|
||||||
DM_edit = 0,
|
DM_edit = 0,
|
||||||
DM_run,
|
DM_run,
|
||||||
DM_academic,
|
DM_academic,
|
||||||
DM_baseModel
|
DM_baseModel,
|
||||||
|
DM_customHMI,
|
||||||
|
DM_previewHMI
|
||||||
};
|
};
|
||||||
|
|
||||||
//端口类型
|
//端口类型
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,11 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/baseItemPropertyProxy.h
|
include/baseItemPropertyProxy.h
|
||||||
include/dataSourceDlg.h
|
include/dataSourceDlg.h
|
||||||
include/createHMIdlg.h
|
include/createHMIdlg.h
|
||||||
|
include/customHMIGenerateDlg.h
|
||||||
include/propertyDialog.h
|
include/propertyDialog.h
|
||||||
include/eventPropertyEditor.h
|
include/eventPropertyEditor.h
|
||||||
|
include/selectPanel.h
|
||||||
|
include/customHMIList.h
|
||||||
include/graphicsDataModel/baseModel.h
|
include/graphicsDataModel/baseModel.h
|
||||||
include/graphicsDataModel/fixedPortsModel.h
|
include/graphicsDataModel/fixedPortsModel.h
|
||||||
include/graphicsItem/graphicsItemGroup.h
|
include/graphicsItem/graphicsItemGroup.h
|
||||||
|
|
@ -197,7 +200,10 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/baseItemPropertyProxy.cpp
|
source/baseItemPropertyProxy.cpp
|
||||||
source/dataSourceDlg.cpp
|
source/dataSourceDlg.cpp
|
||||||
source/createHMIdlg.cpp
|
source/createHMIdlg.cpp
|
||||||
|
source/customHMIGenerateDlg.cpp
|
||||||
source/propertyDialog.cpp
|
source/propertyDialog.cpp
|
||||||
|
source/selectPanel.cpp
|
||||||
|
source/customHMIList.cpp
|
||||||
source/graphicsDataModel/baseModel.cpp
|
source/graphicsDataModel/baseModel.cpp
|
||||||
source/graphicsDataModel/fixedPortsModel.cpp
|
source/graphicsDataModel/fixedPortsModel.cpp
|
||||||
source/graphicsItem/graphicsItemGroup.cpp
|
source/graphicsItem/graphicsItemGroup.cpp
|
||||||
|
|
@ -285,24 +291,15 @@ set(UI_FILES
|
||||||
ui/bayMeasureDlg.ui
|
ui/bayMeasureDlg.ui
|
||||||
ui/dataSourceDlg.ui
|
ui/dataSourceDlg.ui
|
||||||
ui/createHMIdlg.ui
|
ui/createHMIdlg.ui
|
||||||
|
ui/customHMIGenerateDlg.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
add_library(diagramCavas SHARED
|
||||||
qt_add_library(diagramCavas SHARED
|
|
||||||
MANUAL_FINALIZATION
|
|
||||||
${DIAGRAMCAVAS_HEADER_FILES}
|
${DIAGRAMCAVAS_HEADER_FILES}
|
||||||
${DIAGRAMCAVAS_SOURCE_FILES}
|
${DIAGRAMCAVAS_SOURCE_FILES}
|
||||||
${UI_FILES}
|
${UI_FILES}
|
||||||
../resource/DiagramDesigner.qrc
|
../resource/DiagramDesigner.qrc
|
||||||
)
|
)
|
||||||
else()
|
|
||||||
add_library(diagramCavas SHARED
|
|
||||||
${DIAGRAMCAVAS_HEADER_FILES}
|
|
||||||
${DIAGRAMCAVAS_SOURCE_FILES}
|
|
||||||
${UI_FILES}
|
|
||||||
../resource/DiagramDesigner.qrc
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(diagramCavas PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
target_link_libraries(diagramCavas PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||||
Qt${QT_VERSION_MAJOR}::Gui
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
|
|
@ -319,15 +316,21 @@ option(BUILD_SHARED_LIBS "Build as shared library" ON)
|
||||||
|
|
||||||
target_include_directories(diagramCavas PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
target_include_directories(diagramCavas PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
target_link_libraries(diagramCavas PRIVATE diagramUtils)
|
target_link_libraries(diagramCavas PUBLIC diagramUtils)
|
||||||
target_link_libraries(diagramCavas PRIVATE diagramCommunication)
|
target_link_libraries(diagramCavas PUBLIC diagramCommunication)
|
||||||
target_link_libraries(diagramCavas PRIVATE pluginManager)
|
target_link_libraries(diagramCavas PUBLIC pluginManager)
|
||||||
target_link_libraries(diagramCavas PUBLIC PropertyEditor)
|
target_link_libraries(diagramCavas PUBLIC PropertyEditor)
|
||||||
|
|
||||||
target_compile_definitions(diagramCavas
|
target_compile_definitions(diagramCavas
|
||||||
PUBLIC
|
|
||||||
DIAGRAM_DESIGNER_SHARED
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
DIAGRAM_DESIGNER_EXPORTS
|
DIAGRAM_DESIGNER_EXPORTS
|
||||||
#QT_NO_KEYWORDS
|
PUBLIC
|
||||||
|
DIAGRAM_DESIGNER_SHARED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_target_properties(diagramCavas PROPERTIES
|
||||||
|
PREFIX "" # DLL没有lib前缀
|
||||||
|
OUTPUT_NAME "diagramCavas" # DLL的基本名称
|
||||||
|
IMPORT_PREFIX "lib" # 导入库有lib前缀
|
||||||
|
IMPORT_SUFFIX ".dll.a" # 导入库后缀
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,11 @@ public:
|
||||||
void showDlg();
|
void showDlg();
|
||||||
signals:
|
signals:
|
||||||
void createHMI(QString,QString,int type = 0); //HMI名称,系统图名称,模板类型
|
void createHMI(QString,QString,int type = 0); //HMI名称,系统图名称,模板类型
|
||||||
|
void createCustomHMI(QString,QString,int type = 0); //HMI名称,系统图名称,模板类型
|
||||||
public slots:
|
public slots:
|
||||||
void onSaveClicked();
|
void onSaveClicked();
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
|
void onCustomClicked();
|
||||||
private:
|
private:
|
||||||
Ui::createHMIdlg *ui;
|
Ui::createHMIdlg *ui;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
#ifndef CUSTOMHMICREATEDLG_H
|
||||||
|
#define CUSTOMHMICREATEDLG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class customHMIGenerateDlg; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class SelectPanel;
|
||||||
|
class PowerEntity;
|
||||||
|
class DiagramCavas;
|
||||||
|
class CustomHMIList;
|
||||||
|
struct HierarchyItem;
|
||||||
|
|
||||||
|
class CustomHMIGenerateDlg : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CustomHMIGenerateDlg(QWidget *parent = nullptr);
|
||||||
|
~CustomHMIGenerateDlg();
|
||||||
|
|
||||||
|
void initial();
|
||||||
|
void showDlg(QString,QString,int); //hmi名,系统图名,模板
|
||||||
|
signals:
|
||||||
|
void backCreateHMI(); //退回初始界面信号
|
||||||
|
public slots:
|
||||||
|
void onGenerateClicked();
|
||||||
|
void onBackClicked();
|
||||||
|
void onPreviewHMI(QList<HierarchyItem>);
|
||||||
|
private:
|
||||||
|
Ui::customHMIGenerateDlg *ui;
|
||||||
|
SelectPanel* _pOperatePanel; //操作界面
|
||||||
|
SelectPanel* _pPreviewPanel; //预览界面
|
||||||
|
PowerEntity* _pPe;
|
||||||
|
PowerEntity* _pOe;
|
||||||
|
DiagramCavas* _pCanvas = nullptr;
|
||||||
|
CustomHMIList* _pItemList;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
#ifndef CUSTOMHMILIST_H
|
||||||
|
#define CUSTOMHMILIST_H
|
||||||
|
|
||||||
|
/******************自定义创建HMI时的list******************/
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QTreeView>
|
||||||
|
#include <QStandardItem>
|
||||||
|
#include "common/core_model/topology.h"
|
||||||
|
|
||||||
|
class CustomHMIList : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CustomHMIList(QWidget *parent = nullptr);
|
||||||
|
~CustomHMIList();
|
||||||
|
void initial();
|
||||||
|
void generatePreview(); //预览自定义HMI
|
||||||
|
signals:
|
||||||
|
void previewHMI(QList<HierarchyItem>); //生成监控
|
||||||
|
public slots:
|
||||||
|
void onUpdateItems(QList<HierarchyItem>,bool refresh); //更新当前设备列表
|
||||||
|
void onSelectItems(QList<HierarchyItem>); //更新当前选中的设备
|
||||||
|
void onMonitorCreated(QList<HierarchyItem>); //创建后的设备列表
|
||||||
|
void onItemChanged(QStandardItem *item); //item勾选事件
|
||||||
|
private:
|
||||||
|
void resetSelect(); //重置选中
|
||||||
|
void setChildrenCheckState(QStandardItem *parent, Qt::CheckState state);
|
||||||
|
void traverseSelectStandardItemModel(QStandardItemModel *model,Qt::CheckState); //遍历选中
|
||||||
|
void traverseSelectStandardItem(QStandardItem *item, int depth,Qt::CheckState); //遍历选中
|
||||||
|
|
||||||
|
QList<QStandardItem*> getCheckedItems(QStandardItem* parentItem); //返回checked对象
|
||||||
|
QList<QStandardItem*> getTreeViewCheckedItems(QTreeView* treeView); //返回checked对象
|
||||||
|
|
||||||
|
// 查找间隔节点
|
||||||
|
QStandardItem* findBayItem(const QString& bayName);
|
||||||
|
private:
|
||||||
|
QTreeView* _tree;
|
||||||
|
QStandardItemModel* _modelAll; //图中所有item
|
||||||
|
// 存储间隔名称到树节点的映射,提高查找效率
|
||||||
|
QHash<QString, QStandardItem*> m_mapBayItems;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -28,7 +28,7 @@ class ExtraPropertyManager;
|
||||||
class PluginManager;
|
class PluginManager;
|
||||||
class PluginItemFactory;
|
class PluginItemFactory;
|
||||||
|
|
||||||
class DIAGRAM_DESIGNER_PUBLIC DiagramCavas : public QMdiArea
|
class DIAGRAM_DESIGNER_PUBLIC DiagramCavas : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DECLARE_PRIVATE(DiagramCavas)
|
Q_DECLARE_PRIVATE(DiagramCavas)
|
||||||
|
|
@ -64,6 +64,7 @@ signals:
|
||||||
|
|
||||||
void createHMI(QString,QUuid);
|
void createHMI(QString,QUuid);
|
||||||
void updateHMI(QString,QUuid,int,QString);
|
void updateHMI(QString,QUuid,int,QString);
|
||||||
|
void clearSelection();
|
||||||
public slots:
|
public slots:
|
||||||
void onSignal_addDrawingPanel(PowerEntity* p,DiagramMode = DM_edit,QString parent = QString()); //parent:派生运行时的page
|
void onSignal_addDrawingPanel(PowerEntity* p,DiagramMode = DM_edit,QString parent = QString()); //parent:派生运行时的page
|
||||||
void onSignal_addGraphicsItem(ModelStateInfo&);
|
void onSignal_addGraphicsItem(ModelStateInfo&);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class PluginManager;
|
||||||
class PluginItemFactory;
|
class PluginItemFactory;
|
||||||
class QDetailsView;
|
class QDetailsView;
|
||||||
class PropertyDlg;
|
class PropertyDlg;
|
||||||
|
class CustomHMIGenerateDlg;
|
||||||
|
|
||||||
class DiagramCavasPrivate
|
class DiagramCavasPrivate
|
||||||
{
|
{
|
||||||
|
|
@ -41,11 +42,13 @@ public:
|
||||||
StructDataPreviewDlg* _structDataPreviewDlg = nullptr;
|
StructDataPreviewDlg* _structDataPreviewDlg = nullptr;
|
||||||
ExtraPropertyManager* _extraPropertyManager = nullptr;
|
ExtraPropertyManager* _extraPropertyManager = nullptr;
|
||||||
CreateHMIdlg* _createHMIDlg = nullptr;
|
CreateHMIdlg* _createHMIDlg = nullptr;
|
||||||
|
CustomHMIGenerateDlg* _customCreateHMIDlg = nullptr;
|
||||||
QDetailsView* _pPropertyPage = nullptr;
|
QDetailsView* _pPropertyPage = nullptr;
|
||||||
PropertyDlg* _pPropertyDlg = nullptr;
|
PropertyDlg* _pPropertyDlg = nullptr;
|
||||||
PluginManager* m_pluginManager = nullptr;
|
PluginManager* m_pluginManager = nullptr;
|
||||||
PluginItemFactory* m_itemFactory = nullptr;
|
PluginItemFactory* m_itemFactory = nullptr;
|
||||||
QMap<QString, PluginTypeInfo> m_pluginInfo;
|
QMap<QString, PluginTypeInfo> m_pluginInfo;
|
||||||
|
QMdiArea* m_mdiArea = nullptr;
|
||||||
int _curMode = 0;
|
int _curMode = 0;
|
||||||
|
|
||||||
// 私有方法
|
// 私有方法
|
||||||
|
|
@ -62,6 +65,9 @@ public:
|
||||||
void onTargetSelected(QObject*); //对象选中事件(属性)
|
void onTargetSelected(QObject*); //对象选中事件(属性)
|
||||||
void onCreateHMI(); //创建HMI
|
void onCreateHMI(); //创建HMI
|
||||||
void updateHMIFromDB(); //从数据库中更新HMI信息
|
void updateHMIFromDB(); //从数据库中更新HMI信息
|
||||||
|
void updateHMIListFormDB(); //从DB更新HMI列表(page中load)
|
||||||
|
void deletePanel(const QString& name,int nType);
|
||||||
|
void setCurMode(int);
|
||||||
|
|
||||||
//显示属性相关
|
//显示属性相关
|
||||||
void showPropertyDlgImpl(); // 显示属性页
|
void showPropertyDlgImpl(); // 显示属性页
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ class MonitorPanel;
|
||||||
class ItemPropertyDlg;
|
class ItemPropertyDlg;
|
||||||
class BayMeasureDlg;
|
class BayMeasureDlg;
|
||||||
struct MeasurementInfo;
|
struct MeasurementInfo;
|
||||||
|
class SelectPanel;
|
||||||
|
|
||||||
class FixedPortsModel : public BaseModel, public Serializable
|
class FixedPortsModel : public BaseModel, public Serializable
|
||||||
{
|
{
|
||||||
|
|
@ -125,6 +126,7 @@ public:
|
||||||
void setMonitorDisplaySetting(QMap<MonitorItemTypeStruct,QMap<MonitorItemStateStruct,MonitorItemDisplayInfo>> map){m_monitorDisplaySetting = map;}
|
void setMonitorDisplaySetting(QMap<MonitorItemTypeStruct,QMap<MonitorItemStateStruct,MonitorItemDisplayInfo>> map){m_monitorDisplaySetting = map;}
|
||||||
QMap<MonitorItemTypeStruct,QMap<MonitorItemStateStruct,MonitorItemDisplayInfo>>& getMonitorDisplaySetting(){return m_monitorDisplaySetting;}
|
QMap<MonitorItemTypeStruct,QMap<MonitorItemStateStruct,MonitorItemDisplayInfo>>& getMonitorDisplaySetting(){return m_monitorDisplaySetting;}
|
||||||
|
|
||||||
|
void previewHMI(SelectPanel* pPreview,QList<HierarchyItem>); //customHMI 生成预览
|
||||||
QList<HMIImageRef>& getHMIimageRef(){return _HMIimageRef;}
|
QList<HMIImageRef>& getHMIimageRef(){return _HMIimageRef;}
|
||||||
QList<HMICustomImageRef>& getHMICustomImageRef(){return _HMICustomImageRef;}
|
QList<HMICustomImageRef>& getHMICustomImageRef(){return _HMICustomImageRef;}
|
||||||
int imageRefExist(QString model,QByteArray hash256);
|
int imageRefExist(QString model,QByteArray hash256);
|
||||||
|
|
@ -154,9 +156,12 @@ public:
|
||||||
void setCavas(QPointer<DiagramCavas> p) {_cavas = p;} //设置所属顶层容器
|
void setCavas(QPointer<DiagramCavas> p) {_cavas = p;} //设置所属顶层容器
|
||||||
DiagramCavas* getCavas();
|
DiagramCavas* getCavas();
|
||||||
int getCurMode(); //获取当前模式
|
int getCurMode(); //获取当前模式
|
||||||
|
void clearCurItems(); //清空当前item
|
||||||
|
void setPanelMode(int n) {_panelMode = n;}
|
||||||
|
int getPanelMode(){return _panelMode;}
|
||||||
|
|
||||||
QMap<QUuid,GraphicsFunctionModelItem*> getHMIItems(){return _nodeItem;}
|
QMap<QUuid,GraphicsFunctionModelItem*>& getHMIItems(){return _nodeItem;}
|
||||||
QMap<QUuid,ElectricBayItem*> getProjectBayItems(){return _bayItem;}
|
QMap<QUuid,ElectricBayItem*>& getProjectBayItems(){return _bayItem;}
|
||||||
QMap<QUuid,GraphicsFunctionModelItem*> getGraphicItems(){return _graphicItem;}
|
QMap<QUuid,GraphicsFunctionModelItem*> getGraphicItems(){return _graphicItem;}
|
||||||
|
|
||||||
void setPageState(int n) {_pageState = n;}
|
void setPageState(int n) {_pageState = n;}
|
||||||
|
|
@ -215,6 +220,7 @@ private:
|
||||||
QList<HMIImageRef> _HMIimageRef; //当前HMI中图片的引用关系
|
QList<HMIImageRef> _HMIimageRef; //当前HMI中图片的引用关系
|
||||||
QList<HMICustomImageRef> _HMICustomImageRef; //当前HMI中图片项的引用
|
QList<HMICustomImageRef> _HMICustomImageRef; //当前HMI中图片项的引用
|
||||||
QMap<QUuid, QMap<QString, bool*>> _mapSelectedRefs; //item属性可见性(属性栏使用)
|
QMap<QUuid, QMap<QString, bool*>> _mapSelectedRefs; //item属性可见性(属性栏使用)
|
||||||
|
int _panelMode = 0; //当前panel模式0普通 1预览
|
||||||
public:
|
public:
|
||||||
static bool _dataInitialised;
|
static bool _dataInitialised;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,14 @@ class ElectricBayItem :public GraphicsNonStandardItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricBayItem(const QRectF &rect, QGraphicsItem *parent = 0); //genNewPort生成新接线点
|
ElectricBayItem(const QRectF &rect, QGraphicsItem *parent = 0); //genNewPort生成新接线点
|
||||||
|
ElectricBayItem(const ElectricBayItem&);
|
||||||
virtual ~ElectricBayItem();
|
virtual ~ElectricBayItem();
|
||||||
|
virtual ElectricBayItem* clone() const override;
|
||||||
|
|
||||||
void setText(const QString& s);
|
void setText(const QString& s);
|
||||||
protected:
|
protected:
|
||||||
virtual QPainterPath shape();
|
virtual QPainterPath shape() override;
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
private:
|
private:
|
||||||
void updateTextShape();
|
void updateTextShape();
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@ public:
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelConnectLineItem(QGraphicsItem *parent = 0);
|
ElectricFunctionModelConnectLineItem(QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelConnectLineItem(const ElectricFunctionModelConnectLineItem&);
|
||||||
virtual ~ElectricFunctionModelConnectLineItem();
|
virtual ~ElectricFunctionModelConnectLineItem();
|
||||||
|
virtual ElectricFunctionModelConnectLineItem *clone() const override;
|
||||||
|
|
||||||
void setStartPoint(const QPointF& p);
|
void setStartPoint(const QPointF& p);
|
||||||
void setEndPoint(const QPointF& p);
|
void setEndPoint(const QPointF& p);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ public:
|
||||||
Q_PROPERTY(int FontSize READ getFontSize WRITE setFontSize)
|
Q_PROPERTY(int FontSize READ getFontSize WRITE setFontSize)
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelItemText(QGraphicsItem *parent = 0);
|
ElectricFunctionModelItemText(QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelItemText(const ElectricFunctionModelItemText&);
|
||||||
virtual ~ElectricFunctionModelItemText();
|
virtual ~ElectricFunctionModelItemText();
|
||||||
|
virtual ElectricFunctionModelItemText* clone() const override;
|
||||||
|
|
||||||
void setText(const QString& text);
|
void setText(const QString& text);
|
||||||
QString getText() {return m_text;}
|
QString getText() {return m_text;}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelPortItem :public GraphicsFunctionModelItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelPortItem(QGraphicsItem *parent = 0);
|
ElectricFunctionModelPortItem(QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelPortItem(const ElectricFunctionModelPortItem&);
|
||||||
virtual ~ElectricFunctionModelPortItem();
|
virtual ~ElectricFunctionModelPortItem();
|
||||||
|
virtual ElectricFunctionModelPortItem* clone() const override;
|
||||||
|
|
||||||
void addPort();
|
void addPort();
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ public:
|
||||||
Q_PROPERTY(QFileInfo Image READ getImage_1 WRITE setImage_1)
|
Q_PROPERTY(QFileInfo Image READ getImage_1 WRITE setImage_1)
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgGroup(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgGroup(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgGroup(const ElectricFunctionModelSvgGroup&);
|
||||||
virtual ~ElectricFunctionModelSvgGroup();
|
virtual ~ElectricFunctionModelSvgGroup();
|
||||||
|
virtual ElectricFunctionModelSvgGroup* clone() const override;
|
||||||
void resize(int,double, double, const QPointF&) override;
|
void resize(int,double, double, const QPointF&) override;
|
||||||
void updateCoordinate() override;
|
void updateCoordinate() override;
|
||||||
void move(const QPointF&) override;
|
void move(const QPointF&) override;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgGroupCT :public ElectricFunctionModelSvgGroup
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgGroupCT(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgGroupCT(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgGroupCT(const ElectricFunctionModelSvgGroupCT&);
|
||||||
virtual ~ElectricFunctionModelSvgGroupCT();
|
virtual ~ElectricFunctionModelSvgGroupCT();
|
||||||
|
virtual ElectricFunctionModelSvgGroupCT* clone() const override;
|
||||||
virtual void setupFinish(QVariant) override;
|
virtual void setupFinish(QVariant) override;
|
||||||
virtual void updateItem() override;
|
virtual void updateItem() override;
|
||||||
void setCtType(int n){_nType = n;}
|
void setCtType(int n){_nType = n;}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgGroupPT :public ElectricFunctionModelSvgGroup
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgGroupPT(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgGroupPT(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgGroupPT(const ElectricFunctionModelSvgGroupPT&);
|
||||||
virtual ~ElectricFunctionModelSvgGroupPT();
|
virtual ~ElectricFunctionModelSvgGroupPT();
|
||||||
|
virtual ElectricFunctionModelSvgGroupPT* clone() const override;
|
||||||
virtual void setupFinish(QVariant) override;
|
virtual void setupFinish(QVariant) override;
|
||||||
virtual void updateItem() override;
|
virtual void updateItem() override;
|
||||||
virtual void updateLayout() override;
|
virtual void updateLayout() override;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ public:
|
||||||
Q_PROPERTY(QFileInfo Image READ getImage_1 WRITE setImage_1)
|
Q_PROPERTY(QFileInfo Image READ getImage_1 WRITE setImage_1)
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItem(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItem(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItem(const ElectricFunctionModelSvgItem&);
|
||||||
virtual ~ElectricFunctionModelSvgItem();
|
virtual ~ElectricFunctionModelSvgItem();
|
||||||
|
virtual ElectricFunctionModelSvgItem* clone() const override;
|
||||||
|
|
||||||
void updateCoordinate() override;
|
void updateCoordinate() override;
|
||||||
void move(const QPointF&) override;
|
void move(const QPointF&) override;
|
||||||
virtual void loadSvg(){};
|
virtual void loadSvg(){};
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelSvgItem2wTransformer :public ElectricFunctionModelSvg
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItem2wTransformer(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItem2wTransformer(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItem2wTransformer(const ElectricFunctionModelSvgItem2wTransformer&);
|
||||||
virtual ~ElectricFunctionModelSvgItem2wTransformer();
|
virtual ~ElectricFunctionModelSvgItem2wTransformer();
|
||||||
|
virtual ElectricFunctionModelSvgItem2wTransformer* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelSvgItem3wTransformer :public ElectricFunctionModelSvg
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItem3wTransformer(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItem3wTransformer(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItem3wTransformer(const ElectricFunctionModelSvgItem3wTransformer&);
|
||||||
virtual ~ElectricFunctionModelSvgItem3wTransformer();
|
virtual ~ElectricFunctionModelSvgItem3wTransformer();
|
||||||
|
virtual ElectricFunctionModelSvgItem3wTransformer* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgItemBus :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemBus(const QRect &rect, QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemBus(const QRect &rect, QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemBus(const ElectricFunctionModelSvgItemBus&);
|
||||||
virtual ~ElectricFunctionModelSvgItemBus();
|
virtual ~ElectricFunctionModelSvgItemBus();
|
||||||
|
virtual ElectricFunctionModelSvgItemBus* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
void addPort();
|
void addPort();
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@ class ElectricFunctionModelSvgItemCB :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemCB(const QRect &rect, bool genNewPort = true,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemCB(const QRect &rect, bool genNewPort = true,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemCB(const ElectricFunctionModelSvgItemCB&);
|
||||||
virtual ~ElectricFunctionModelSvgItemCB();
|
virtual ~ElectricFunctionModelSvgItemCB();
|
||||||
|
virtual ElectricFunctionModelSvgItemCB* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgItemCT :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemCT(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemCT(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemCT(const ElectricFunctionModelSvgItemCT&);
|
||||||
virtual ~ElectricFunctionModelSvgItemCT();
|
virtual ~ElectricFunctionModelSvgItemCT();
|
||||||
|
virtual ElectricFunctionModelSvgItemCT* clone() const override;
|
||||||
void setItemType(int n){_itemType = n;}
|
void setItemType(int n){_itemType = n;}
|
||||||
private:
|
private:
|
||||||
void initial();
|
void initial();
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelSvgItemCableEnd :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemCableEnd(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemCableEnd(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemCableEnd(const ElectricFunctionModelSvgItemCableEnd&);
|
||||||
virtual ~ElectricFunctionModelSvgItemCableEnd();
|
virtual ~ElectricFunctionModelSvgItemCableEnd();
|
||||||
|
virtual ElectricFunctionModelSvgItemCableEnd* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelSvgItemCableTer :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemCableTer(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemCableTer(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemCableTer(const ElectricFunctionModelSvgItemCableTer&);
|
||||||
virtual ~ElectricFunctionModelSvgItemCableTer();
|
virtual ~ElectricFunctionModelSvgItemCableTer();
|
||||||
|
virtual ElectricFunctionModelSvgItemCableTer* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgItemDS :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemDS(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemDS(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemDS(const ElectricFunctionModelSvgItemDS&);
|
||||||
virtual ~ElectricFunctionModelSvgItemDS();
|
virtual ~ElectricFunctionModelSvgItemDS();
|
||||||
|
virtual ElectricFunctionModelSvgItemDS* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelSvgItemDTEDS:public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemDTEDS(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemDTEDS(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemDTEDS(const ElectricFunctionModelSvgItemDTEDS&);
|
||||||
virtual ~ElectricFunctionModelSvgItemDTEDS();
|
virtual ~ElectricFunctionModelSvgItemDTEDS();
|
||||||
|
virtual ElectricFunctionModelSvgItemDTEDS* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgItemES :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemES(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemES(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemES(const ElectricFunctionModelSvgItemES&);
|
||||||
virtual ~ElectricFunctionModelSvgItemES();
|
virtual ~ElectricFunctionModelSvgItemES();
|
||||||
|
virtual ElectricFunctionModelSvgItemES* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgItemFES :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemFES(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemFES(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemFES(const ElectricFunctionModelSvgItemFES&);
|
||||||
virtual ~ElectricFunctionModelSvgItemFES();
|
virtual ~ElectricFunctionModelSvgItemFES();
|
||||||
|
virtual ElectricFunctionModelSvgItemFES* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@ public:
|
||||||
Q_PROPERTY(int TextSize READ getFontSize WRITE setFontSize)
|
Q_PROPERTY(int TextSize READ getFontSize WRITE setFontSize)
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemImage(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemImage(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemImage(const ElectricFunctionModelSvgItemImage&);
|
||||||
virtual ~ElectricFunctionModelSvgItemImage();
|
virtual ~ElectricFunctionModelSvgItemImage();
|
||||||
|
virtual ElectricFunctionModelSvgItemImage* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
|
|
||||||
void setText(const QString& text);
|
void setText(const QString& text);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelSvgItemLA :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemLA(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemLA(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemLA(const ElectricFunctionModelSvgItemLA&);
|
||||||
virtual ~ElectricFunctionModelSvgItemLA();
|
virtual ~ElectricFunctionModelSvgItemLA();
|
||||||
|
virtual ElectricFunctionModelSvgItemLA* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ class ElectricFunctionModelSvgItemPI :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemPI(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemPI(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemPI(const ElectricFunctionModelSvgItemPI&);
|
||||||
virtual ~ElectricFunctionModelSvgItemPI();
|
virtual ~ElectricFunctionModelSvgItemPI();
|
||||||
|
virtual ElectricFunctionModelSvgItemPI* clone() const override;
|
||||||
virtual void setImage_1(QFileInfo) override;
|
virtual void setImage_1(QFileInfo) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ class ElectricFunctionModelSvgItemPT :public ElectricFunctionModelSvgItem
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElectricFunctionModelSvgItemPT(const QRect &rect,QGraphicsItem *parent = 0);
|
ElectricFunctionModelSvgItemPT(const QRect &rect,QGraphicsItem *parent = 0);
|
||||||
|
ElectricFunctionModelSvgItemPT(const ElectricFunctionModelSvgItemPT&);
|
||||||
virtual ~ElectricFunctionModelSvgItemPT();
|
virtual ~ElectricFunctionModelSvgItemPT();
|
||||||
|
virtual ElectricFunctionModelSvgItemPT* clone() const override;
|
||||||
void setItemType(int n){_itemType = n;}
|
void setItemType(int n){_itemType = n;}
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ public:
|
||||||
Q_PROPERTY(EventList Events READ getEvents WRITE setEvents)
|
Q_PROPERTY(EventList Events READ getEvents WRITE setEvents)
|
||||||
public:
|
public:
|
||||||
GraphicsFunctionModelItem(QGraphicsItem *parent);
|
GraphicsFunctionModelItem(QGraphicsItem *parent);
|
||||||
|
GraphicsFunctionModelItem(const GraphicsFunctionModelItem&);
|
||||||
virtual ~GraphicsFunctionModelItem();
|
virtual ~GraphicsFunctionModelItem();
|
||||||
|
virtual GraphicsFunctionModelItem* clone() const override;
|
||||||
|
|
||||||
QMap<QString,bool> getMap(); //bool值为数据源指针类型
|
QMap<QString,bool> getMap(); //bool值为数据源指针类型
|
||||||
void setMap(QMap<QString,bool>);
|
void setMap(QMap<QString,bool>);
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,9 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include "propertyType/dataSourceType.h"
|
#include "propertyType/dataSourceType.h"
|
||||||
|
#include "graphicsDataModel/fixedPortsModel.h"
|
||||||
//#include "graphicsItem/itemPort.h"
|
//#include "graphicsItem/itemPort.h"
|
||||||
|
|
||||||
class FixedPortsModel;
|
|
||||||
|
|
||||||
enum ShapeType
|
enum ShapeType
|
||||||
{
|
{
|
||||||
T_undefined,
|
T_undefined,
|
||||||
|
|
@ -161,10 +160,15 @@ public:
|
||||||
{
|
{
|
||||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
}
|
}
|
||||||
|
GraphicsNonStandardItem(const GraphicsNonStandardItem& obj)
|
||||||
|
:AbstractShapeType<QGraphicsItem>(obj)
|
||||||
|
{
|
||||||
|
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
|
}
|
||||||
virtual ~GraphicsNonStandardItem(){};
|
virtual ~GraphicsNonStandardItem(){};
|
||||||
|
virtual GraphicsNonStandardItem* clone() const = 0;
|
||||||
virtual void setProperty(AbstractProperty* p){_property = p;}
|
virtual void setProperty(AbstractProperty* p){_property = p;}
|
||||||
virtual AbstractProperty* getProperty() {return _property;}
|
virtual AbstractProperty* getProperty() {return _property;}
|
||||||
|
|
||||||
bool containsPoint(const QPointF& pos)
|
bool containsPoint(const QPointF& pos)
|
||||||
{
|
{
|
||||||
QPointF localPos = mapFromScene(pos);
|
QPointF localPos = mapFromScene(pos);
|
||||||
|
|
@ -238,8 +242,8 @@ public:
|
||||||
virtual bool hasDynamicText(const QString& tag);
|
virtual bool hasDynamicText(const QString& tag);
|
||||||
virtual void setDynamicLayoutRadius(qreal radius);
|
virtual void setDynamicLayoutRadius(qreal radius);
|
||||||
virtual QMap<QString,HandleText*> getDynamicText() {return m_mapDynamicText;}
|
virtual QMap<QString,HandleText*> getDynamicText() {return m_mapDynamicText;}
|
||||||
void setHandle(FixedPortsModel* p){_pHandle = p;}
|
void setHandle(QPointer<FixedPortsModel> p){_pHandle = p;}
|
||||||
FixedPortsModel* getHandle() {return _pHandle;}
|
FixedPortsModel* getHandle() {return _pHandle.data();}
|
||||||
virtual void img_1_selected(QString sMeta,QString sModel,QByteArray img){};
|
virtual void img_1_selected(QString sMeta,QString sModel,QByteArray img){};
|
||||||
virtual void img_2_selected(QString sMeta,QString sModel,QByteArray img){};
|
virtual void img_2_selected(QString sMeta,QString sModel,QByteArray img){};
|
||||||
virtual void img_3_selected(QString sMeta,QString sModel,QByteArray img){};
|
virtual void img_3_selected(QString sMeta,QString sModel,QByteArray img){};
|
||||||
|
|
@ -529,7 +533,7 @@ protected:
|
||||||
QList<QRectF> getAllComponentRects() const; //获取图所有碰撞矩形
|
QList<QRectF> getAllComponentRects() const; //获取图所有碰撞矩形
|
||||||
QList<QPainterPath> getObstacleShapes() const; //获取所有碰撞shape
|
QList<QPainterPath> getObstacleShapes() const; //获取所有碰撞shape
|
||||||
protected:
|
protected:
|
||||||
FixedPortsModel* _pHandle;
|
QPointer<FixedPortsModel> _pHandle;
|
||||||
ModelProperty* _property;
|
ModelProperty* _property;
|
||||||
PowerEntity* _pEntity; //图元拓扑
|
PowerEntity* _pEntity; //图元拓扑
|
||||||
bool _itemChanged; //图元变化标志,判断是否需要保存
|
bool _itemChanged; //图元变化标志,判断是否需要保存
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ public:
|
||||||
void removeContent(QWidget* content);
|
void removeContent(QWidget* content);
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* _layout;
|
QVBoxLayout* _layout;
|
||||||
|
QWidget* _curWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef SELECTPANEL_H
|
||||||
|
#define SELECTPANEL_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "baseDrawingPanel.h"
|
||||||
|
|
||||||
|
/***********自定义生成HMI操作画布***********/
|
||||||
|
|
||||||
|
class PowerEntity;
|
||||||
|
|
||||||
|
class SelectPanel : public BaseDrawingPanel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SelectPanel(PowerEntity* pEntity,QWidget *parent = nullptr,DiagramMode mode = DM_customHMI);
|
||||||
|
~SelectPanel();
|
||||||
|
|
||||||
|
QJsonObject getDiagramInfo(); //重载
|
||||||
|
virtual void loadNodes(QJsonObject obj) override; //加载图元信息
|
||||||
|
void clearItems(); //清空当前item
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -9,7 +9,7 @@ CornerMonitorLauncher::CornerMonitorLauncher(QMdiArea* parent)
|
||||||
,m_mdiArea(parent)
|
,m_mdiArea(parent)
|
||||||
{
|
{
|
||||||
setFixedSize(48, 48);
|
setFixedSize(48, 48);
|
||||||
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
|
||||||
positionAtCorner();
|
positionAtCorner();
|
||||||
|
|
@ -70,8 +70,16 @@ void CornerMonitorLauncher::showQuickMenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CornerMonitorLauncher::positionAtCorner() {
|
void CornerMonitorLauncher::positionAtCorner() {
|
||||||
|
if (!m_mdiArea || !m_mdiArea->isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取mdiArea右上角在屏幕坐标系中的位置
|
||||||
QPoint topRight = m_mdiArea->mapToGlobal(m_mdiArea->rect().topRight());
|
QPoint topRight = m_mdiArea->mapToGlobal(m_mdiArea->rect().topRight());
|
||||||
|
|
||||||
int x = topRight.x() - width() - 20;
|
int x = topRight.x() - width() - 20;
|
||||||
int y = topRight.y() + 20;
|
int y = topRight.y() + 20;
|
||||||
|
|
||||||
|
// 如果这是顶级窗口,直接使用屏幕坐标
|
||||||
move(x, y);
|
move(x, y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ void CreateHMIdlg::initial()
|
||||||
{
|
{
|
||||||
connect(ui->btn_cancel,&QPushButton::clicked,this,&CreateHMIdlg::onCancelClicked);
|
connect(ui->btn_cancel,&QPushButton::clicked,this,&CreateHMIdlg::onCancelClicked);
|
||||||
connect(ui->btn_ok,&QPushButton::clicked,this,&CreateHMIdlg::onSaveClicked);
|
connect(ui->btn_ok,&QPushButton::clicked,this,&CreateHMIdlg::onSaveClicked);
|
||||||
|
connect(ui->btn_custom,&QPushButton::clicked,this,&CreateHMIdlg::onCustomClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateHMIdlg::showDlg()
|
void CreateHMIdlg::showDlg()
|
||||||
|
|
@ -39,6 +40,13 @@ void CreateHMIdlg::onCancelClicked()
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateHMIdlg::onCustomClicked()
|
||||||
|
{
|
||||||
|
QString sName = ui->cb_structure->currentText();
|
||||||
|
emit createCustomHMI(ui->lineEdit->text(),sName);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
void CreateHMIdlg::onSaveClicked()
|
void CreateHMIdlg::onSaveClicked()
|
||||||
{
|
{
|
||||||
QString sName = ui->cb_structure->currentText();
|
QString sName = ui->cb_structure->currentText();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
#include "customHMIGenerateDlg.h"
|
||||||
|
#include "dataBase.h"
|
||||||
|
#include "selectPanel.h"
|
||||||
|
#include "powerEntity.h"
|
||||||
|
#include "diagramCavas.h"
|
||||||
|
#include "customHMIList.h"
|
||||||
|
#include "ui_customHMIGenerateDlg.h"
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
CustomHMIGenerateDlg::CustomHMIGenerateDlg(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
, ui(new Ui::customHMIGenerateDlg)
|
||||||
|
,_pOperatePanel(nullptr)
|
||||||
|
,_pPreviewPanel(nullptr)
|
||||||
|
,_pPe(nullptr)
|
||||||
|
,_pOe(nullptr)
|
||||||
|
,_pItemList(nullptr)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
_pCanvas = dynamic_cast<DiagramCavas*>(parent);
|
||||||
|
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomHMIGenerateDlg::~CustomHMIGenerateDlg()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
if(_pPe)
|
||||||
|
delete _pPe;
|
||||||
|
if(_pOe)
|
||||||
|
delete _pOe;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIGenerateDlg::initial()
|
||||||
|
{
|
||||||
|
_pItemList = new CustomHMIList(this);
|
||||||
|
connect(ui->btn_return,&QPushButton::clicked,this,&CustomHMIGenerateDlg::onBackClicked);
|
||||||
|
connect(ui->btn_generate,&QPushButton::clicked,this,&CustomHMIGenerateDlg::onGenerateClicked);
|
||||||
|
QVBoxLayout* layOut = new QVBoxLayout(ui->gb_list);
|
||||||
|
layOut->addWidget(_pItemList);
|
||||||
|
|
||||||
|
_pPe = new ConfigurationDiagram("0","oprerate");
|
||||||
|
_pOperatePanel = new SelectPanel(_pPe,this,DM_customHMI);
|
||||||
|
|
||||||
|
_pOe = new ConfigurationDiagram("1","preview");
|
||||||
|
_pPreviewPanel = new SelectPanel(_pOe,this,DM_customHMI);
|
||||||
|
|
||||||
|
QVBoxLayout *layOperate = new QVBoxLayout(ui->gb_sys);
|
||||||
|
layOperate->addWidget(_pOperatePanel);
|
||||||
|
_pOperatePanel->getModelController()->setCavas(QPointer<DiagramCavas>(_pCanvas));
|
||||||
|
|
||||||
|
QVBoxLayout *layPreview= new QVBoxLayout(ui->gb_preview);
|
||||||
|
layPreview->addWidget(_pPreviewPanel);
|
||||||
|
_pPreviewPanel->getModelController()->setCavas(QPointer<DiagramCavas>(_pCanvas));
|
||||||
|
|
||||||
|
connect(_pOperatePanel->getModelController(),&FixedPortsModel::updateCurrentItems,_pItemList,&CustomHMIList::onUpdateItems);
|
||||||
|
connect(_pOperatePanel->getModelController(),&FixedPortsModel::itemSelected,_pItemList,&CustomHMIList::onSelectItems);
|
||||||
|
connect(_pItemList,&CustomHMIList::previewHMI,this,&CustomHMIGenerateDlg::onPreviewHMI);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIGenerateDlg::showDlg(QString sHmi,QString sSys,int nModel)
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
ui->le_hmiName->setText(sHmi);
|
||||||
|
DataBase* db = DataBase::GetInstance();
|
||||||
|
if (!db) {
|
||||||
|
qWarning() << "Database instance is null";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pOperatePanel->getModelController()->clearCurItems(); //先清空
|
||||||
|
QJsonObject context = db->getHMIContextByTag(sSys);
|
||||||
|
_pOperatePanel->loadNodes(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIGenerateDlg::onGenerateClicked()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIGenerateDlg::onBackClicked()
|
||||||
|
{
|
||||||
|
emit backCreateHMI();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIGenerateDlg::onPreviewHMI(QList<HierarchyItem> lst)
|
||||||
|
{
|
||||||
|
_pPreviewPanel->clearItems();
|
||||||
|
_pOperatePanel->getModelController()->previewHMI(_pPreviewPanel,lst);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,252 @@
|
||||||
|
#include "customHMIList.h"
|
||||||
|
#include <QToolTip>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include "tools.h"
|
||||||
|
|
||||||
|
CustomHMIList::CustomHMIList(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
,_modelAll(nullptr)
|
||||||
|
,_tree(nullptr)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomHMIList::~CustomHMIList()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::initial()
|
||||||
|
{
|
||||||
|
QVBoxLayout* layOut = new QVBoxLayout(this);
|
||||||
|
_tree = new QTreeView(this);
|
||||||
|
layOut->addWidget(_tree);
|
||||||
|
layOut->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
|
|
||||||
|
_modelAll = new QStandardItemModel(this);
|
||||||
|
_tree->setModel(_modelAll);
|
||||||
|
_tree->setHeaderHidden(true);
|
||||||
|
connect(_modelAll, &QStandardItemModel::itemChanged,this, &CustomHMIList::onItemChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::onUpdateItems(QList<HierarchyItem> lst,bool refresh)
|
||||||
|
{
|
||||||
|
if(refresh){
|
||||||
|
QStandardItem *root = _modelAll->invisibleRootItem();
|
||||||
|
int rowCount = root->rowCount();
|
||||||
|
if (rowCount > 0) {
|
||||||
|
_modelAll->removeRows(0, rowCount);
|
||||||
|
}
|
||||||
|
// 清空间隔节点缓存
|
||||||
|
m_mapBayItems.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先处理间隔节点(nCategory == 1)
|
||||||
|
for(auto &info:lst){
|
||||||
|
auto curItem = info.item;
|
||||||
|
if(curItem.nCategory == 1){ // 间隔信息
|
||||||
|
// 查找是否已存在该间隔节点
|
||||||
|
QStandardItem* pBayItem = findBayItem(curItem.sName);
|
||||||
|
if(!pBayItem){
|
||||||
|
// 创建间隔节点
|
||||||
|
pBayItem = new QStandardItem(curItem.sName);
|
||||||
|
pBayItem->setCheckable(true); // 启用勾选框
|
||||||
|
pBayItem->setCheckState(Qt::Unchecked);
|
||||||
|
pBayItem->setData(curItem.nCategory, Qt::UserRole+1); // 存储类别
|
||||||
|
pBayItem->setData(curItem.nEquipType, Qt::UserRole+2); // 存储设备类型
|
||||||
|
pBayItem->setData(curItem.uid, Qt::UserRole+3); // 存储UUID
|
||||||
|
|
||||||
|
// 存储到缓存中
|
||||||
|
m_mapBayItems[curItem.sName] = pBayItem;
|
||||||
|
_modelAll->appendRow(pBayItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 再处理设备节点(nCategory == 0)
|
||||||
|
for(auto &info:lst){
|
||||||
|
auto curItem = info.item;
|
||||||
|
if(curItem.nCategory == 0){ // 设备信息
|
||||||
|
// 获取设备所属的间隔名称
|
||||||
|
QString bayName = info.parent.sName;
|
||||||
|
|
||||||
|
if(!bayName.isEmpty()){
|
||||||
|
// 查找对应的间隔节点
|
||||||
|
QStandardItem* pBayItem = findBayItem(bayName);
|
||||||
|
|
||||||
|
if(pBayItem){
|
||||||
|
// 创建设备节点
|
||||||
|
QStandardItem *pItem = new QStandardItem(curItem.sName);
|
||||||
|
pItem->setCheckable(true); // 启用勾选框
|
||||||
|
pItem->setCheckState(Qt::Unchecked);
|
||||||
|
pItem->setData(curItem.nCategory, Qt::UserRole+1);
|
||||||
|
pItem->setData(curItem.nEquipType, Qt::UserRole+2);
|
||||||
|
pItem->setData(curItem.uid, Qt::UserRole+3);
|
||||||
|
|
||||||
|
// 不再为母线或独立设备添加子设备
|
||||||
|
// 所有设备都作为间隔的直接子节点
|
||||||
|
|
||||||
|
pBayItem->appendRow(pItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 展开所有节点
|
||||||
|
_tree->expandAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::onSelectItems(QList<HierarchyItem> lst)
|
||||||
|
{
|
||||||
|
resetSelect();
|
||||||
|
for(auto& info:lst){
|
||||||
|
QModelIndex itemIndex = findIndex(_modelAll,info.item.uid,Qt::UserRole+3);
|
||||||
|
if(itemIndex.isValid())
|
||||||
|
{
|
||||||
|
QStandardItem *pItem = _modelAll->itemFromIndex(itemIndex);
|
||||||
|
pItem->setCheckState(Qt::Checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
generatePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::generatePreview()
|
||||||
|
{
|
||||||
|
QList<HierarchyItem> lst;
|
||||||
|
QList<QStandardItem*> lstItem = getTreeViewCheckedItems(_tree);
|
||||||
|
for(auto& pItem:lstItem){
|
||||||
|
HierarchyItem info;
|
||||||
|
auto pParent = pItem->parent();
|
||||||
|
if(pParent){
|
||||||
|
info.parent.nCategory = pParent->data(Qt::UserRole+1).toInt();
|
||||||
|
info.parent.nEquipType = pParent->data(Qt::UserRole+2).toInt();
|
||||||
|
info.parent.uid = pParent->data(Qt::UserRole+3).toUuid();
|
||||||
|
info.parent.sName = pParent->text();
|
||||||
|
}
|
||||||
|
info.item.nCategory = pItem->data(Qt::UserRole+1).toInt();
|
||||||
|
info.item.nEquipType = pItem->data(Qt::UserRole+2).toInt();
|
||||||
|
info.item.uid = pItem->data(Qt::UserRole+3).toUuid();
|
||||||
|
info.item.sName = pItem->text();
|
||||||
|
|
||||||
|
auto lstChild = getAllChildren(pItem);
|
||||||
|
for(auto &child:lstChild){
|
||||||
|
HierarchyStructItem stru;
|
||||||
|
stru.nCategory = child->data(Qt::UserRole+1).toInt();
|
||||||
|
stru.nEquipType = child->data(Qt::UserRole+2).toInt();
|
||||||
|
stru.uid = child->data(Qt::UserRole+3).toUuid();
|
||||||
|
stru.sName = child->text();
|
||||||
|
info.subList.append(stru);
|
||||||
|
}
|
||||||
|
lst.append(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit previewHMI(lst);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::onMonitorCreated(QList<HierarchyItem> lst)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::onItemChanged(QStandardItem *item)
|
||||||
|
{
|
||||||
|
QSignalBlocker blocker(_modelAll);
|
||||||
|
|
||||||
|
if (item->isCheckable()) {
|
||||||
|
Qt::CheckState newState = item->checkState();
|
||||||
|
// 设置所有子项与父项相同的状态
|
||||||
|
setChildrenCheckState(item, newState);
|
||||||
|
}
|
||||||
|
|
||||||
|
_tree->repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::setChildrenCheckState(QStandardItem *parent, Qt::CheckState state) {
|
||||||
|
for (int row = 0; row < parent->rowCount(); ++row) {
|
||||||
|
QStandardItem *child = parent->child(row, 0); // 第一列
|
||||||
|
if (child && child->isCheckable()) {
|
||||||
|
child->setCheckState(state);
|
||||||
|
setChildrenCheckState(child, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::traverseSelectStandardItemModel(QStandardItemModel *model,Qt::CheckState check) {
|
||||||
|
if (!model) return;
|
||||||
|
|
||||||
|
// 遍历所有顶层项
|
||||||
|
for (int row = 0; row < model->rowCount(); ++row) {
|
||||||
|
for (int col = 0; col < model->columnCount(); ++col) {
|
||||||
|
QStandardItem *item = model->item(row, col);
|
||||||
|
item->setCheckState(check);
|
||||||
|
traverseSelectStandardItem(item, 0,check);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::traverseSelectStandardItem(QStandardItem *item, int depth,Qt::CheckState check) {
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
// 遍历子项
|
||||||
|
for (int row = 0; row < item->rowCount(); ++row) {
|
||||||
|
for (int col = 0; col < item->columnCount(); ++col) {
|
||||||
|
QStandardItem *child = item->child(row, col);
|
||||||
|
child->setCheckState(check);
|
||||||
|
traverseSelectStandardItem(child, depth + 1,check);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QStandardItem* CustomHMIList::findBayItem(const QString& bayName)
|
||||||
|
{
|
||||||
|
// 先从缓存查找
|
||||||
|
if(m_mapBayItems.contains(bayName)){
|
||||||
|
return m_mapBayItems[bayName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 遍历查找
|
||||||
|
for(int i = 0; i < _modelAll->rowCount(); ++i){
|
||||||
|
QStandardItem* pItem = _modelAll->item(i);
|
||||||
|
if(pItem->text() == bayName &&
|
||||||
|
pItem->data(Qt::UserRole+1).toInt() == 1){ // 类别为间隔
|
||||||
|
return pItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QStandardItem*> CustomHMIList::getCheckedItems(QStandardItem* parentItem) {
|
||||||
|
QList<QStandardItem*> checkedItems;
|
||||||
|
|
||||||
|
if (!parentItem) return checkedItems;
|
||||||
|
|
||||||
|
for (int i = 0; i < parentItem->rowCount(); ++i) {
|
||||||
|
QStandardItem* childItem = parentItem->child(i);
|
||||||
|
|
||||||
|
if (childItem->checkState() == Qt::Checked) {
|
||||||
|
checkedItems.append(childItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归检查子项
|
||||||
|
checkedItems.append(getCheckedItems(childItem));
|
||||||
|
}
|
||||||
|
|
||||||
|
return checkedItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 主函数:获取treeView中所有checked项
|
||||||
|
QList<QStandardItem*> CustomHMIList::getTreeViewCheckedItems(QTreeView* treeView) {
|
||||||
|
QList<QStandardItem*> checkedItems;
|
||||||
|
|
||||||
|
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(treeView->model());
|
||||||
|
if (!model) return checkedItems;
|
||||||
|
|
||||||
|
QStandardItem* rootItem = model->invisibleRootItem();
|
||||||
|
return getCheckedItems(rootItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomHMIList::resetSelect()
|
||||||
|
{
|
||||||
|
traverseSelectStandardItemModel(_modelAll,Qt::Unchecked);
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include "designerView.h"
|
#include "designerView.h"
|
||||||
#include "designerScene.h"
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#define MAX_ZoomValue 50.0
|
#define MAX_ZoomValue 50.0
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include "diagramCavas_p.h"
|
#include "diagramCavas_p.h"
|
||||||
|
|
||||||
DiagramCavas::DiagramCavas(QWidget *parent)
|
DiagramCavas::DiagramCavas(QWidget *parent)
|
||||||
: QMdiArea(parent)
|
: QWidget(parent)
|
||||||
,d_ptr(new DiagramCavasPrivate(this))
|
,d_ptr(new DiagramCavasPrivate(this))
|
||||||
{
|
{
|
||||||
Q_D(DiagramCavas);
|
Q_D(DiagramCavas);
|
||||||
|
|
@ -11,8 +11,8 @@ DiagramCavas::DiagramCavas(QWidget *parent)
|
||||||
DiagramCavas::~DiagramCavas()
|
DiagramCavas::~DiagramCavas()
|
||||||
{
|
{
|
||||||
Q_D(DiagramCavas);
|
Q_D(DiagramCavas);
|
||||||
delete d;
|
|
||||||
disconnect(); //断开连接避免动态库释放时信号问题
|
disconnect(); //断开连接避免动态库释放时信号问题
|
||||||
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
MonitorPanel* DiagramCavas::getMonitorPanel(QString sPage)
|
MonitorPanel* DiagramCavas::getMonitorPanel(QString sPage)
|
||||||
|
|
@ -68,15 +68,7 @@ void DiagramCavas::initial()
|
||||||
void DiagramCavas::setCurMode(int nMode)
|
void DiagramCavas::setCurMode(int nMode)
|
||||||
{
|
{
|
||||||
Q_D(DiagramCavas);
|
Q_D(DiagramCavas);
|
||||||
d->_curMode = nMode;
|
d->setCurMode(nMode);
|
||||||
if(d->_curMode == 1){ //运行模式下
|
|
||||||
showPropertyDlg();
|
|
||||||
//setViewMode(QMdiArea::SubWindowView);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
hidePropertyDlg();
|
|
||||||
//setViewMode(QMdiArea::TabbedView);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DiagramCavas::getCurMode()
|
int DiagramCavas::getCurMode()
|
||||||
|
|
@ -120,14 +112,10 @@ void DiagramCavas::onSignal_addDrawingPanel(PowerEntity* pItem,DiagramMode mode,
|
||||||
|
|
||||||
void DiagramCavas::onSignal_addGraphicsItem(ModelStateInfo& info)
|
void DiagramCavas::onSignal_addGraphicsItem(ModelStateInfo& info)
|
||||||
{
|
{
|
||||||
QMdiSubWindow* actWindow = activeSubWindow();
|
/*QMdiSubWindow* actWindow = activeSubWindow();
|
||||||
if(!actWindow)
|
if(!actWindow)
|
||||||
return;
|
return;
|
||||||
QWidget* pWindow= currentSubWindow()->widget();
|
QWidget* pWindow= currentSubWindow()->widget();*/
|
||||||
/*DrawingPanel* pPanel = dynamic_cast<DrawingPanel*>(pWindow);
|
|
||||||
|
|
||||||
if(pPanel)
|
|
||||||
pPanel->onSignal_addGraphicsItem(info);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagramCavas::onSignal_addPage()
|
void DiagramCavas::onSignal_addPage()
|
||||||
|
|
@ -183,12 +171,7 @@ void DiagramCavas::onSignal_activatePage(const QString& name)
|
||||||
void DiagramCavas::onSignal_panelDelete(const QString& name,int nType)
|
void DiagramCavas::onSignal_panelDelete(const QString& name,int nType)
|
||||||
{
|
{
|
||||||
Q_D(DiagramCavas);
|
Q_D(DiagramCavas);
|
||||||
if(nType == 2){
|
d->deletePanel(name,nType);
|
||||||
MonitorPanel* pPanel = d->m_mapMonitorPanel.take(name).first;
|
|
||||||
this->removeSubWindow(pPanel);
|
|
||||||
delete pPanel;
|
|
||||||
}
|
|
||||||
d->calculateLauncherVisible();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagramCavas::onSignal_createEntity(EntityInfo info)
|
void DiagramCavas::onSignal_createEntity(EntityInfo info)
|
||||||
|
|
@ -469,6 +452,9 @@ void DiagramCavas::updateMonitorListFromDB(int dest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
Q_D(DiagramCavas);
|
||||||
|
d->updateHMIListFormDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagramCavas::onSignal_updateMonitorTopology(QList<QUuid> lst)
|
void DiagramCavas::onSignal_updateMonitorTopology(QList<QUuid> lst)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QMetaMethod>
|
#include <QMetaMethod>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
#include <QHBoxLayout>
|
||||||
#include "graphicsItem/graphicsBaseItem.h"
|
#include "graphicsItem/graphicsBaseItem.h"
|
||||||
#include "topologyManager.h"
|
#include "topologyManager.h"
|
||||||
#include "powerEntity.h"
|
#include "powerEntity.h"
|
||||||
|
|
@ -29,10 +30,12 @@
|
||||||
#include "structDataPreviewDlg.h"
|
#include "structDataPreviewDlg.h"
|
||||||
#include "extraPropertyManager.h"
|
#include "extraPropertyManager.h"
|
||||||
#include "createHMIdlg.h"
|
#include "createHMIdlg.h"
|
||||||
|
#include "customHMIGenerateDlg.h"
|
||||||
#include "pluginManager.h"
|
#include "pluginManager.h"
|
||||||
#include "graphicsItem/pluginItemFactory.h"
|
#include "graphicsItem/pluginItemFactory.h"
|
||||||
#include "QDetailsView.h"
|
#include "QDetailsView.h"
|
||||||
#include "propertyDialog.h"
|
#include "propertyDialog.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
#include "basePannelPropertyProxy.h"
|
#include "basePannelPropertyProxy.h"
|
||||||
#include "QDetailsView.h"
|
#include "QDetailsView.h"
|
||||||
|
|
@ -63,6 +66,10 @@ DiagramCavasPrivate::DiagramCavasPrivate(DiagramCavas* q)
|
||||||
DiagramCavasPrivate::~DiagramCavasPrivate()
|
DiagramCavasPrivate::~DiagramCavasPrivate()
|
||||||
{
|
{
|
||||||
// 清理代码
|
// 清理代码
|
||||||
|
if(_pPropertyPage){
|
||||||
|
//_pPropertyPage->setObject(new QObject(q_ptr));
|
||||||
|
delete _pPropertyPage;
|
||||||
|
}
|
||||||
if (_cornerButton) delete _cornerButton;
|
if (_cornerButton) delete _cornerButton;
|
||||||
if (_loadMonitorPageDlg) delete _loadMonitorPageDlg;
|
if (_loadMonitorPageDlg) delete _loadMonitorPageDlg;
|
||||||
if (_connectSetting) delete _connectSetting;
|
if (_connectSetting) delete _connectSetting;
|
||||||
|
|
@ -76,6 +83,7 @@ void DiagramCavasPrivate::initialImpl()
|
||||||
{
|
{
|
||||||
Q_Q(DiagramCavas);
|
Q_Q(DiagramCavas);
|
||||||
|
|
||||||
|
m_mdiArea = new QMdiArea(q);
|
||||||
// 1. 读取数据并初始化页面
|
// 1. 读取数据并初始化页面
|
||||||
QList<PageInfo> lst = DataBase::GetInstance()->getAllPage();
|
QList<PageInfo> lst = DataBase::GetInstance()->getAllPage();
|
||||||
for (auto &info : lst) {
|
for (auto &info : lst) {
|
||||||
|
|
@ -83,8 +91,9 @@ void DiagramCavasPrivate::initialImpl()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 初始化角落监控启动器
|
// 2. 初始化角落监控启动器
|
||||||
_cornerButton = new CornerMonitorLauncher(q);
|
_cornerButton = new CornerMonitorLauncher(m_mdiArea);
|
||||||
_cornerButton->showDlg();
|
_cornerButton->showDlg();
|
||||||
|
//LOG_INFO("CanvasIni", QString("Insert bay fail"));
|
||||||
|
|
||||||
// 3. 初始化加载监控页面对话框
|
// 3. 初始化加载监控页面对话框
|
||||||
_loadMonitorPageDlg = new LoadMonitorPageDlg(q);
|
_loadMonitorPageDlg = new LoadMonitorPageDlg(q);
|
||||||
|
|
@ -143,7 +152,14 @@ void DiagramCavasPrivate::initialImpl()
|
||||||
// 12. 初始化创建HMI对话框
|
// 12. 初始化创建HMI对话框
|
||||||
_createHMIDlg = new CreateHMIdlg(q);
|
_createHMIDlg = new CreateHMIdlg(q);
|
||||||
QObject::connect(_createHMIDlg, &CreateHMIdlg::createHMI, q, &DiagramCavas::onSignal_createHMIClicked);
|
QObject::connect(_createHMIDlg, &CreateHMIdlg::createHMI, q, &DiagramCavas::onSignal_createHMIClicked);
|
||||||
|
QObject::connect(_createHMIDlg, &CreateHMIdlg::createCustomHMI, q, [this](QString sName,QString sSys,int nModel){
|
||||||
|
_customCreateHMIDlg->showDlg(sName,sSys,nModel);
|
||||||
|
});
|
||||||
|
|
||||||
|
_customCreateHMIDlg = new CustomHMIGenerateDlg(q);
|
||||||
|
QObject::connect(_customCreateHMIDlg, &CustomHMIGenerateDlg::backCreateHMI, q, [this](){
|
||||||
|
_createHMIDlg->showDlg();
|
||||||
|
});
|
||||||
// 13. 从数据库更新HMI列表
|
// 13. 从数据库更新HMI列表
|
||||||
q->updateHMIlstFromDB();
|
q->updateHMIlstFromDB();
|
||||||
|
|
||||||
|
|
@ -164,7 +180,7 @@ void DiagramCavasPrivate::initialImpl()
|
||||||
m_pluginManager->loadAllPlugins(pluginsDir);
|
m_pluginManager->loadAllPlugins(pluginsDir);
|
||||||
|
|
||||||
// 18. 初始化属性对话框
|
// 18. 初始化属性对话框
|
||||||
_pPropertyDlg = new PropertyDlg(q->parentWidget());
|
_pPropertyDlg = new PropertyDlg();
|
||||||
_pPropertyDlg->hide();
|
_pPropertyDlg->hide();
|
||||||
|
|
||||||
// 19. 添加快捷键
|
// 19. 添加快捷键
|
||||||
|
|
@ -172,6 +188,9 @@ void DiagramCavasPrivate::initialImpl()
|
||||||
|
|
||||||
// 20. 设置视图模式
|
// 20. 设置视图模式
|
||||||
// q->setViewMode(QMdiArea::TabbedView);
|
// q->setViewMode(QMdiArea::TabbedView);
|
||||||
|
QHBoxLayout* mainLayout = new QHBoxLayout(q);
|
||||||
|
mainLayout->addWidget(m_mdiArea, 1); // 主工作区占主要空间
|
||||||
|
mainLayout->addWidget(_pPropertyDlg, 0); // 属性栏占次要空间
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagramCavasPrivate::removePanel(PowerEntity* pEntity)
|
void DiagramCavasPrivate::removePanel(PowerEntity* pEntity)
|
||||||
|
|
@ -185,8 +204,8 @@ void DiagramCavasPrivate::removePanel(PowerEntity* pEntity)
|
||||||
MonitorPanel* pPanel = m_mapMonitorPanel.take(iter.key()).first;
|
MonitorPanel* pPanel = m_mapMonitorPanel.take(iter.key()).first;
|
||||||
|
|
||||||
QWidget* pWindow = static_cast<QWidget*>(pPanel);
|
QWidget* pWindow = static_cast<QWidget*>(pPanel);
|
||||||
q->setActiveSubWindow(iter->second);
|
m_mdiArea->setActiveSubWindow(iter->second);
|
||||||
q->closeActiveSubWindow();
|
m_mdiArea->closeActiveSubWindow();
|
||||||
//removeSubWindow(pPanel);
|
//removeSubWindow(pPanel);
|
||||||
//todo:记录删除组态图,从数据库中删除
|
//todo:记录删除组态图,从数据库中删除
|
||||||
delete pPanel;
|
delete pPanel;
|
||||||
|
|
@ -306,7 +325,7 @@ void DiagramCavasPrivate::processRecommandData(const HttpRecommandInfo& info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 获取当前子窗口
|
// 3. 获取当前子窗口
|
||||||
QMdiSubWindow* currentSubWindow = q->currentSubWindow();
|
QMdiSubWindow* currentSubWindow = m_mdiArea->currentSubWindow();
|
||||||
if (!currentSubWindow) {
|
if (!currentSubWindow) {
|
||||||
qDebug() << "No active window, skipping panel update";
|
qDebug() << "No active window, skipping panel update";
|
||||||
return;
|
return;
|
||||||
|
|
@ -340,12 +359,24 @@ void DiagramCavasPrivate::processRecommandData(const HttpRecommandInfo& info)
|
||||||
void DiagramCavasPrivate::onTargetSelected(QObject* obj)
|
void DiagramCavasPrivate::onTargetSelected(QObject* obj)
|
||||||
{
|
{
|
||||||
Q_Q(DiagramCavas);
|
Q_Q(DiagramCavas);
|
||||||
if(obj){
|
|
||||||
if(_curMode == 0)
|
if (!obj) return;
|
||||||
|
|
||||||
|
if (_curMode == 0) { // 编辑模式
|
||||||
|
// 发送给主窗口
|
||||||
emit q->selectTarget(obj);
|
emit q->selectTarget(obj);
|
||||||
else
|
|
||||||
|
// 确保运行模式属性页清空
|
||||||
|
if (_pPropertyPage) {
|
||||||
|
_pPropertyPage->setObject(q);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // 运行模式
|
||||||
|
// 只在实际显示时才设置
|
||||||
|
if (_pPropertyPage && _pPropertyDlg && _pPropertyDlg->isVisible()) {
|
||||||
_pPropertyPage->setObject(obj);
|
_pPropertyPage->setObject(obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagramCavasPrivate::onCreateHMI()
|
void DiagramCavasPrivate::onCreateHMI()
|
||||||
|
|
@ -366,11 +397,56 @@ void DiagramCavasPrivate::updateHMIFromDB()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiagramCavasPrivate::updateHMIListFormDB()
|
||||||
|
{
|
||||||
|
_loadMonitorPageDlg->clearItems();
|
||||||
|
|
||||||
|
QList<HMIPageInfo> lstHMI = DataBase::GetInstance()->getAllHMI();
|
||||||
|
for(auto &info:lstHMI)
|
||||||
|
{
|
||||||
|
auto p = TopologyManager::instance().findDiagram(info.uid.toString(),ModelFunctionType::RuntimeModel);
|
||||||
|
if(!p){
|
||||||
|
TopologyManager::instance().createDiagram(info.uid.toString(),info.name,ModelFunctionType::RuntimeModel);
|
||||||
|
_loadMonitorPageDlg->updateItems("HMI组态",qMakePair(info.name,info.uid));
|
||||||
|
}
|
||||||
|
else{ //存在直接更新
|
||||||
|
_loadMonitorPageDlg->updateItems("HMI组态",qMakePair(info.name,info.uid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramCavasPrivate::deletePanel(const QString& name,int nType)
|
||||||
|
{
|
||||||
|
if(nType == 2){
|
||||||
|
MonitorPanel* pPanel = m_mapMonitorPanel.take(name).first;
|
||||||
|
m_mdiArea->removeSubWindow(pPanel);
|
||||||
|
delete pPanel;
|
||||||
|
}
|
||||||
|
calculateLauncherVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramCavasPrivate::setCurMode(int nMode)
|
||||||
|
{
|
||||||
|
Q_Q(DiagramCavas);
|
||||||
|
_curMode = nMode;
|
||||||
|
|
||||||
|
if (_curMode == 1) { // 运行模式
|
||||||
|
emit q->clearSelection(); // 通知主窗口清空
|
||||||
|
|
||||||
|
// 延迟显示属性对话框
|
||||||
|
QTimer::singleShot(100, q, [q]() {
|
||||||
|
q->showPropertyDlg();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else { // 编辑模式
|
||||||
|
q->hidePropertyDlg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DiagramCavasPrivate::initPropertyPage()
|
void DiagramCavasPrivate::initPropertyPage()
|
||||||
{
|
{
|
||||||
if (_pPropertyPage == nullptr) {
|
if (_pPropertyPage == nullptr) {
|
||||||
_pPropertyPage = new QDetailsView();
|
_pPropertyPage = new QDetailsView();
|
||||||
_pPropertyPage->setObject(new QObject(q_ptr));
|
|
||||||
|
|
||||||
// 可以在这里配置属性页的更多设置
|
// 可以在这里配置属性页的更多设置
|
||||||
_pPropertyPage->setWindowTitle("属性面板");
|
_pPropertyPage->setWindowTitle("属性面板");
|
||||||
|
|
@ -384,7 +460,7 @@ void DiagramCavasPrivate::initPropertyPage()
|
||||||
|
|
||||||
void DiagramCavasPrivate::showPropertyDlgImpl()
|
void DiagramCavasPrivate::showPropertyDlgImpl()
|
||||||
{
|
{
|
||||||
Q_Q(DiagramCavas);
|
/*Q_Q(DiagramCavas);
|
||||||
|
|
||||||
// 确保属性页面已初始化
|
// 确保属性页面已初始化
|
||||||
initPropertyPage();
|
initPropertyPage();
|
||||||
|
|
@ -403,20 +479,36 @@ void DiagramCavasPrivate::showPropertyDlgImpl()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置内容
|
// 设置内容
|
||||||
_pPropertyDlg->setContent(_pPropertyPage);
|
|
||||||
_pPropertyDlg->show();
|
_pPropertyDlg->show();
|
||||||
|
_pPropertyDlg->setContent(_pPropertyPage);*/
|
||||||
|
//_pPropertyPage->setObject(q_ptr);
|
||||||
|
|
||||||
// 居中显示
|
// 居中显示
|
||||||
centerPropertyDialogOnScreen();
|
//centerPropertyDialogOnScreen();
|
||||||
|
|
||||||
// 激活窗口
|
// 激活窗口
|
||||||
_pPropertyDlg->raise();
|
//_pPropertyDlg->raise();
|
||||||
_pPropertyDlg->activateWindow();
|
//_pPropertyDlg->activateWindow();
|
||||||
|
Q_Q(DiagramCavas);
|
||||||
|
|
||||||
|
initPropertyPage();
|
||||||
|
|
||||||
|
if (!_pPropertyDlg) {
|
||||||
|
_pPropertyDlg = new PropertyDlg(q->parentWidget());
|
||||||
|
}
|
||||||
|
|
||||||
|
_pPropertyDlg->show();
|
||||||
|
_pPropertyDlg->setContent(_pPropertyPage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagramCavasPrivate::hidePropertyDlgImpl()
|
void DiagramCavasPrivate::hidePropertyDlgImpl()
|
||||||
{
|
{
|
||||||
|
Q_Q(DiagramCavas);
|
||||||
if (_pPropertyDlg) {
|
if (_pPropertyDlg) {
|
||||||
|
if(_pPropertyPage)
|
||||||
|
delete _pPropertyPage;
|
||||||
|
_pPropertyPage = nullptr;
|
||||||
_pPropertyDlg->hide();
|
_pPropertyDlg->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -494,7 +586,7 @@ void DiagramCavasPrivate::addMonitorPanel(PowerEntity* pItem, const QString& par
|
||||||
pPanel->setParentPage(parent);
|
pPanel->setParentPage(parent);
|
||||||
|
|
||||||
// 添加到MDI区域
|
// 添加到MDI区域
|
||||||
QMdiSubWindow* pSub = q->addSubWindow(pPanel);
|
QMdiSubWindow* pSub = m_mdiArea->addSubWindow(pPanel);
|
||||||
m_mapMonitorPanel.insert(_curPage, qMakePair(pPanel, pSub));
|
m_mapMonitorPanel.insert(_curPage, qMakePair(pPanel, pSub));
|
||||||
|
|
||||||
// 显示面板
|
// 显示面板
|
||||||
|
|
@ -604,7 +696,7 @@ void DiagramCavasPrivate::savePageImpl()
|
||||||
Q_Q(DiagramCavas);
|
Q_Q(DiagramCavas);
|
||||||
|
|
||||||
// 获取当前子窗口
|
// 获取当前子窗口
|
||||||
QMdiSubWindow* currentSubWindow = q->currentSubWindow();
|
QMdiSubWindow* currentSubWindow = m_mdiArea->currentSubWindow();
|
||||||
if (!currentSubWindow) {
|
if (!currentSubWindow) {
|
||||||
qWarning() << "No active subwindow for saving";
|
qWarning() << "No active subwindow for saving";
|
||||||
QMessageBox::warning(nullptr, QString("警告"),
|
QMessageBox::warning(nullptr, QString("警告"),
|
||||||
|
|
@ -836,7 +928,7 @@ BaseDrawingPanel* DiagramCavasPrivate::getCurrentDrawingPanel() const
|
||||||
{
|
{
|
||||||
Q_Q(const DiagramCavas);
|
Q_Q(const DiagramCavas);
|
||||||
|
|
||||||
QMdiSubWindow* currentSubWindow = q->currentSubWindow();
|
QMdiSubWindow* currentSubWindow = m_mdiArea->currentSubWindow();
|
||||||
if (!currentSubWindow) {
|
if (!currentSubWindow) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -1019,7 +1111,7 @@ bool DiagramCavasPrivate::loadExistingMonitor(const QString& name)
|
||||||
|
|
||||||
// 设置为活动子窗口
|
// 设置为活动子窗口
|
||||||
Q_Q(DiagramCavas);
|
Q_Q(DiagramCavas);
|
||||||
q->setActiveSubWindow(subWindow);
|
m_mdiArea->setActiveSubWindow(subWindow);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "extraPropertyManager.h"
|
#include "extraPropertyManager.h"
|
||||||
|
|
||||||
#include "graphicsItem/itemPort.h"
|
#include "graphicsItem/itemPort.h"
|
||||||
|
#include "designerView.h"
|
||||||
#include "designerScene.h"
|
#include "designerScene.h"
|
||||||
#include "dataBase.h"
|
#include "dataBase.h"
|
||||||
#include "httpInterface.h"
|
#include "httpInterface.h"
|
||||||
|
|
@ -56,6 +57,7 @@
|
||||||
#include "common/core_model/types.h"
|
#include "common/core_model/types.h"
|
||||||
#include "graphicsItem/pluginSvgItemWrapper.h"
|
#include "graphicsItem/pluginSvgItemWrapper.h"
|
||||||
#include "graphicsItem/functionModelItem/graphicsEventContext.h"
|
#include "graphicsItem/functionModelItem/graphicsEventContext.h"
|
||||||
|
#include "selectPanel.h"
|
||||||
|
|
||||||
bool FixedPortsModel::_dataInitialised = false;
|
bool FixedPortsModel::_dataInitialised = false;
|
||||||
|
|
||||||
|
|
@ -1735,6 +1737,8 @@ void FixedPortsModel::onDataTimerOut()
|
||||||
|
|
||||||
void FixedPortsModel::onSelectionChanged()
|
void FixedPortsModel::onSelectionChanged()
|
||||||
{
|
{
|
||||||
|
if(_panelMode == 1) //预览模式不显示属性
|
||||||
|
return;
|
||||||
QList<QGraphicsItem*> selectedItems = _scene->selectedItems();
|
QList<QGraphicsItem*> selectedItems = _scene->selectedItems();
|
||||||
if(_cavas){
|
if(_cavas){
|
||||||
int nMode = _cavas->getCurMode();
|
int nMode = _cavas->getCurMode();
|
||||||
|
|
@ -1827,6 +1831,14 @@ int FixedPortsModel::getCurMode()
|
||||||
return _cavas->getCurMode();
|
return _cavas->getCurMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixedPortsModel::clearCurItems()
|
||||||
|
{
|
||||||
|
if(_scene)
|
||||||
|
_scene->clear();
|
||||||
|
_nodeItem.clear();
|
||||||
|
_bayItem.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void FixedPortsModel::addPortsToItem_json(PortState sta,QJsonArray jArr,GraphicsBaseItem* pItem)
|
void FixedPortsModel::addPortsToItem_json(PortState sta,QJsonArray jArr,GraphicsBaseItem* pItem)
|
||||||
{
|
{
|
||||||
for(QJsonValueRef portJson:jArr)
|
for(QJsonValueRef portJson:jArr)
|
||||||
|
|
@ -2703,6 +2715,73 @@ void FixedPortsModel::stopAcceptData(QString page)
|
||||||
m_dataTimer->stop();
|
m_dataTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixedPortsModel::previewHMI(SelectPanel* pPanel,QList<HierarchyItem> lst)
|
||||||
|
{
|
||||||
|
if(_cavas){
|
||||||
|
|
||||||
|
pPanel->getModelController()->setMonitorRelation(lst);
|
||||||
|
|
||||||
|
QList<HierarchyItem> lstFirst;
|
||||||
|
QList<HierarchyItem> lstSecond;
|
||||||
|
for(auto& itemInfo:lst) //第一次循环处理间隔
|
||||||
|
{
|
||||||
|
if(itemInfo.item.nCategory == 1){ //间隔
|
||||||
|
if(_bayItem.contains(itemInfo.item.uid)){
|
||||||
|
auto pBay = _bayItem.value(itemInfo.item.uid);
|
||||||
|
BayProperty* pPro = dynamic_cast<BayProperty*>(pBay->getProperty());
|
||||||
|
if(pPro){
|
||||||
|
pPanel->getModelController()->addBayByData(pPro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lstFirst.append(itemInfo); //在lst插入时判断重复
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto& itemInfo:lst)
|
||||||
|
{
|
||||||
|
if(itemInfo.item.nCategory == 0){ //设备
|
||||||
|
if(_nodeItem.contains(itemInfo.item.uid)){
|
||||||
|
auto pItem = _nodeItem.value(itemInfo.item.uid);
|
||||||
|
BaseProperty* pPro = dynamic_cast<BaseProperty*>(pItem->getProperty());
|
||||||
|
if(pPro){
|
||||||
|
auto pNewItem = pItem->clone();
|
||||||
|
if(pPro->type() == 8){
|
||||||
|
auto pLine = dynamic_cast<ElectricFunctionModelConnectLineItem*>(pNewItem);
|
||||||
|
if(pLine)
|
||||||
|
pLine->calculatePath();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pNewItem->updateItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pNewItem && pPanel){
|
||||||
|
pNewItem->bindProperty(pPro);
|
||||||
|
pNewItem->updateHandles();
|
||||||
|
pNewItem->updateByProperty(); //使用模型更新自身
|
||||||
|
pPanel->getModelController()->addNodeItem(pPro->uuid(),pNewItem);
|
||||||
|
pPanel->getScene()->addItem(pNewItem); //绑定模型
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lstSecond.append(itemInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pPanel){
|
||||||
|
if (!pPanel->getScene()->items().isEmpty()) {
|
||||||
|
QRectF itemsRect = pPanel->getScene()->itemsBoundingRect();
|
||||||
|
itemsRect.adjust(-100, -100, 100, 100);
|
||||||
|
/*auto map = _cavas->getMapMonitor();
|
||||||
|
if(map.contains(sPage)){
|
||||||
|
auto pSubWin = map.value(sPage).second;
|
||||||
|
pSubWin->resize(itemsRect.width(),itemsRect.height());
|
||||||
|
}*/
|
||||||
|
pPanel->getView()->fitInView(itemsRect, Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int FixedPortsModel::imageRefExist(QString model,QByteArray hash256)
|
int FixedPortsModel::imageRefExist(QString model,QByteArray hash256)
|
||||||
{
|
{
|
||||||
for(auto& info:_HMIimageRef)
|
for(auto& info:_HMIimageRef)
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,26 @@ ElectricBayItem::ElectricBayItem(const QRectF &rect,QGraphicsItem *parent)
|
||||||
setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
|
setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricBayItem::ElectricBayItem(const ElectricBayItem& obj)
|
||||||
|
:GraphicsNonStandardItem(obj)
|
||||||
|
{
|
||||||
|
m_showRect = obj.m_showRect;
|
||||||
|
m_dWidth = obj.m_dWidth;
|
||||||
|
m_dHeight = obj.m_dHeight;
|
||||||
|
m_font = obj.m_font;
|
||||||
|
setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
|
||||||
|
}
|
||||||
|
|
||||||
ElectricBayItem::~ElectricBayItem()
|
ElectricBayItem::~ElectricBayItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricBayItem* ElectricBayItem::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricBayItem(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricBayItem::setText(const QString& text)
|
void ElectricBayItem::setText(const QString& text)
|
||||||
{
|
{
|
||||||
prepareGeometryChange(); // 通知框架几何变化
|
prepareGeometryChange(); // 通知框架几何变化
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,22 @@ ElectricFunctionModelConnectLineItem::ElectricFunctionModelConnectLineItem(QGrap
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelConnectLineItem::ElectricFunctionModelConnectLineItem(const ElectricFunctionModelConnectLineItem& obj)
|
||||||
|
: GraphicsFunctionModelItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
m_lstPoints = obj.m_lstPoints;
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelConnectLineItem::~ElectricFunctionModelConnectLineItem()
|
ElectricFunctionModelConnectLineItem::~ElectricFunctionModelConnectLineItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelConnectLineItem* ElectricFunctionModelConnectLineItem::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelConnectLineItem(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelConnectLineItem::initial()
|
void ElectricFunctionModelConnectLineItem::initial()
|
||||||
{
|
{
|
||||||
m_boundingRect = QRectF();
|
m_boundingRect = QRectF();
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,28 @@ ElectricFunctionModelItemText::ElectricFunctionModelItemText(QGraphicsItem *pare
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelItemText::ElectricFunctionModelItemText(const ElectricFunctionModelItemText& obj)
|
||||||
|
: GraphicsFunctionModelItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
m_boundingRect = obj.m_boundingRect;
|
||||||
|
m_text = obj.m_text;
|
||||||
|
m_textColor = obj.m_textColor;
|
||||||
|
m_backgroundColor = obj.m_backgroundColor;
|
||||||
|
m_font = obj.m_font;
|
||||||
|
m_backgroundVisible = obj.m_backgroundVisible;
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelItemText::~ElectricFunctionModelItemText()
|
ElectricFunctionModelItemText::~ElectricFunctionModelItemText()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelItemText* ElectricFunctionModelItemText::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelItemText(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelItemText::setText(const QString& text)
|
void ElectricFunctionModelItemText::setText(const QString& text)
|
||||||
{
|
{
|
||||||
if (m_text != text) {
|
if (m_text != text) {
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,22 @@ ElectricFunctionModelPortItem::ElectricFunctionModelPortItem(QGraphicsItem *pare
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelPortItem::ElectricFunctionModelPortItem(const ElectricFunctionModelPortItem& obj)
|
||||||
|
: GraphicsFunctionModelItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelPortItem::~ElectricFunctionModelPortItem()
|
ElectricFunctionModelPortItem::~ElectricFunctionModelPortItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelPortItem* ElectricFunctionModelPortItem::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelPortItem(*this);
|
||||||
|
}
|
||||||
|
|
||||||
QRectF ElectricFunctionModelPortItem::boundingRect() const
|
QRectF ElectricFunctionModelPortItem::boundingRect() const
|
||||||
{
|
{
|
||||||
return m_boundingRect;
|
return m_boundingRect;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,27 @@ ElectricFunctionModelSvgGroup::ElectricFunctionModelSvgGroup(const QRect &rect,Q
|
||||||
m_dHeight = rect.height();
|
m_dHeight = rect.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgGroup::ElectricFunctionModelSvgGroup(const ElectricFunctionModelSvgGroup& obj)
|
||||||
|
: GraphicsFunctionModelGroup(obj)
|
||||||
|
{
|
||||||
|
m_lastBoudingRect = obj.m_lastBoudingRect;
|
||||||
|
m_boundingRect = obj.m_boundingRect;
|
||||||
|
m_dWidth = obj.m_dWidth;
|
||||||
|
m_dHeight = obj.m_dHeight;
|
||||||
|
m_mapSvg = obj.m_mapSvg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ElectricFunctionModelSvgGroup::~ElectricFunctionModelSvgGroup()
|
ElectricFunctionModelSvgGroup::~ElectricFunctionModelSvgGroup()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgGroup* ElectricFunctionModelSvgGroup::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgGroup(*this);
|
||||||
|
}
|
||||||
|
|
||||||
QPainterPath ElectricFunctionModelSvgGroup::shape()
|
QPainterPath ElectricFunctionModelSvgGroup::shape()
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,24 @@ ElectricFunctionModelSvgGroupCT::ElectricFunctionModelSvgGroupCT(const QRect &re
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgGroupCT::ElectricFunctionModelSvgGroupCT(const ElectricFunctionModelSvgGroupCT& obj)
|
||||||
|
: ElectricFunctionModelSvgGroup(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
_nType = obj._nType;
|
||||||
|
_nSize = obj._nSize;
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgGroupCT::~ElectricFunctionModelSvgGroupCT()
|
ElectricFunctionModelSvgGroupCT::~ElectricFunctionModelSvgGroupCT()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgGroupCT* ElectricFunctionModelSvgGroupCT::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgGroupCT(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgGroupCT::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgGroupCT::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,23 @@ ElectricFunctionModelSvgGroupPT::ElectricFunctionModelSvgGroupPT(const QRect &re
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgGroupPT::ElectricFunctionModelSvgGroupPT(const ElectricFunctionModelSvgGroupPT& obj)
|
||||||
|
: ElectricFunctionModelSvgGroup(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
m_lstType = obj.m_lstType;
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgGroupPT::~ElectricFunctionModelSvgGroupPT()
|
ElectricFunctionModelSvgGroupPT::~ElectricFunctionModelSvgGroupPT()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgGroupPT* ElectricFunctionModelSvgGroupPT::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgGroupPT(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgGroupPT::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgGroupPT::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,39 @@ ElectricFunctionModelSvgItem::ElectricFunctionModelSvgItem(const QRect &rect,QGr
|
||||||
setFunctionHandleEnaable(false);
|
setFunctionHandleEnaable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItem::ElectricFunctionModelSvgItem(const ElectricFunctionModelSvgItem& obj)
|
||||||
|
: GraphicsFunctionModelItem(obj),m_pRender(nullptr),m_pCustomRender(nullptr)
|
||||||
|
{
|
||||||
|
m_lastBoudingRect = obj.m_lastBoudingRect;
|
||||||
|
m_boundingRect = obj.m_boundingRect;
|
||||||
|
m_dWidth = obj.m_dWidth;
|
||||||
|
m_dHeight = obj.m_dHeight;
|
||||||
|
_tempSvg = obj._tempSvg;
|
||||||
|
m_mapSvg = obj.m_mapSvg;
|
||||||
|
|
||||||
|
setHandleIfShow(H_textCaption,false);
|
||||||
|
setHandleVisible(false);
|
||||||
|
setFunctionHandleIfShow(false);
|
||||||
|
setFunctionHandleEnaable(false);
|
||||||
|
if(!_tempSvg.isEmpty())
|
||||||
|
m_pRender = new QSvgRenderer(_tempSvg);
|
||||||
|
if(!m_pRender){
|
||||||
|
if(!m_mapSvg.isEmpty())
|
||||||
|
loadSvg(m_mapSvg.first());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItem::~ElectricFunctionModelSvgItem()
|
ElectricFunctionModelSvgItem::~ElectricFunctionModelSvgItem()
|
||||||
{
|
{
|
||||||
if(m_pRender)
|
if(m_pRender)
|
||||||
delete m_pRender;
|
delete m_pRender;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItem* ElectricFunctionModelSvgItem::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItem(*this);
|
||||||
|
}
|
||||||
|
|
||||||
QPainterPath ElectricFunctionModelSvgItem::shape()
|
QPainterPath ElectricFunctionModelSvgItem::shape()
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItem2wTransformer::ElectricFunctionModelSvgItem2wTransfo
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItem2wTransformer::ElectricFunctionModelSvgItem2wTransformer(const ElectricFunctionModelSvgItem2wTransformer& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItem2wTransformer::~ElectricFunctionModelSvgItem2wTransformer()
|
ElectricFunctionModelSvgItem2wTransformer::~ElectricFunctionModelSvgItem2wTransformer()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItem2wTransformer* ElectricFunctionModelSvgItem2wTransformer::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItem2wTransformer(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItem2wTransformer::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItem2wTransformer::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,22 @@ ElectricFunctionModelSvgItem3wTransformer::ElectricFunctionModelSvgItem3wTransfo
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItem3wTransformer::ElectricFunctionModelSvgItem3wTransformer(const ElectricFunctionModelSvgItem3wTransformer& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItem3wTransformer::~ElectricFunctionModelSvgItem3wTransformer()
|
ElectricFunctionModelSvgItem3wTransformer::~ElectricFunctionModelSvgItem3wTransformer()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItem3wTransformer* ElectricFunctionModelSvgItem3wTransformer::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItem3wTransformer(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItem3wTransformer::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItem3wTransformer::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,22 @@ ElectricFunctionModelSvgItemBus::ElectricFunctionModelSvgItemBus(const QRect &re
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemBus::ElectricFunctionModelSvgItemBus(const ElectricFunctionModelSvgItemBus& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemBus::~ElectricFunctionModelSvgItemBus()
|
ElectricFunctionModelSvgItemBus::~ElectricFunctionModelSvgItemBus()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemBus* ElectricFunctionModelSvgItemBus::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemBus(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemBus::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemBus::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,22 @@ ElectricFunctionModelSvgItemCB::ElectricFunctionModelSvgItemCB(const QRect &rect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCB::ElectricFunctionModelSvgItemCB(const ElectricFunctionModelSvgItemCB& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemCB::~ElectricFunctionModelSvgItemCB()
|
ElectricFunctionModelSvgItemCB::~ElectricFunctionModelSvgItemCB()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCB* ElectricFunctionModelSvgItemCB::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemCB(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemCB::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemCB::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,23 @@ ElectricFunctionModelSvgItemCT::ElectricFunctionModelSvgItemCT(const QRect &rect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCT::ElectricFunctionModelSvgItemCT(const ElectricFunctionModelSvgItemCT& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
_itemType = obj._itemType;
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemCT::~ElectricFunctionModelSvgItemCT()
|
ElectricFunctionModelSvgItemCT::~ElectricFunctionModelSvgItemCT()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCT* ElectricFunctionModelSvgItemCT::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemCT(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemCT::initial()
|
void ElectricFunctionModelSvgItemCT::initial()
|
||||||
{
|
{
|
||||||
setFlag(QGraphicsItem::ItemIsSelectable, false);
|
setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItemCableEnd::ElectricFunctionModelSvgItemCableEnd(const
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCableEnd::ElectricFunctionModelSvgItemCableEnd(const ElectricFunctionModelSvgItemCableEnd& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemCableEnd::~ElectricFunctionModelSvgItemCableEnd()
|
ElectricFunctionModelSvgItemCableEnd::~ElectricFunctionModelSvgItemCableEnd()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCableEnd* ElectricFunctionModelSvgItemCableEnd::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemCableEnd(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemCableEnd::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemCableEnd::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItemCableTer::ElectricFunctionModelSvgItemCableTer(const
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCableTer::ElectricFunctionModelSvgItemCableTer(const ElectricFunctionModelSvgItemCableTer& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemCableTer::~ElectricFunctionModelSvgItemCableTer()
|
ElectricFunctionModelSvgItemCableTer::~ElectricFunctionModelSvgItemCableTer()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemCableTer* ElectricFunctionModelSvgItemCableTer::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemCableTer(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemCableTer::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemCableTer::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItemDS::ElectricFunctionModelSvgItemDS(const QRect &rect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemDS::ElectricFunctionModelSvgItemDS(const ElectricFunctionModelSvgItemDS& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemDS::~ElectricFunctionModelSvgItemDS()
|
ElectricFunctionModelSvgItemDS::~ElectricFunctionModelSvgItemDS()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemDS* ElectricFunctionModelSvgItemDS::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemDS(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemDS::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemDS::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItemDTEDS::ElectricFunctionModelSvgItemDTEDS(const QRect
|
||||||
inital();
|
inital();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemDTEDS::ElectricFunctionModelSvgItemDTEDS(const ElectricFunctionModelSvgItemDTEDS& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
inital();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemDTEDS::~ElectricFunctionModelSvgItemDTEDS()
|
ElectricFunctionModelSvgItemDTEDS::~ElectricFunctionModelSvgItemDTEDS()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemDTEDS* ElectricFunctionModelSvgItemDTEDS::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemDTEDS(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemDTEDS::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemDTEDS::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItemES::ElectricFunctionModelSvgItemES(const QRect &rect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemES::ElectricFunctionModelSvgItemES(const ElectricFunctionModelSvgItemES& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemES::~ElectricFunctionModelSvgItemES()
|
ElectricFunctionModelSvgItemES::~ElectricFunctionModelSvgItemES()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemES* ElectricFunctionModelSvgItemES::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemES(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemES::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemES::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItemFES::ElectricFunctionModelSvgItemFES(const QRect &re
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemFES::ElectricFunctionModelSvgItemFES(const ElectricFunctionModelSvgItemFES& obj)
|
||||||
|
:ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemFES::~ElectricFunctionModelSvgItemFES()
|
ElectricFunctionModelSvgItemFES::~ElectricFunctionModelSvgItemFES()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemFES* ElectricFunctionModelSvgItemFES::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemFES(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemFES::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemFES::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,24 @@ ElectricFunctionModelSvgItemImage::ElectricFunctionModelSvgItemImage(const QRect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemImage::ElectricFunctionModelSvgItemImage(const ElectricFunctionModelSvgItemImage& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
m_text = obj.m_text;
|
||||||
|
m_textColor = obj.m_textColor;
|
||||||
|
m_font = obj.m_font;
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemImage::~ElectricFunctionModelSvgItemImage()
|
ElectricFunctionModelSvgItemImage::~ElectricFunctionModelSvgItemImage()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemImage* ElectricFunctionModelSvgItemImage::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemImage(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemImage::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemImage::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ ElectricFunctionModelSvgItemLA::ElectricFunctionModelSvgItemLA(const QRect &rect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemLA::ElectricFunctionModelSvgItemLA(const ElectricFunctionModelSvgItemLA& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemLA::~ElectricFunctionModelSvgItemLA()
|
ElectricFunctionModelSvgItemLA::~ElectricFunctionModelSvgItemLA()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemLA* ElectricFunctionModelSvgItemLA::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemLA(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemLA::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemLA::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,22 @@ ElectricFunctionModelSvgItemPI::ElectricFunctionModelSvgItemPI(const QRect &rect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemPI::ElectricFunctionModelSvgItemPI(const ElectricFunctionModelSvgItemPI& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemPI::~ElectricFunctionModelSvgItemPI()
|
ElectricFunctionModelSvgItemPI::~ElectricFunctionModelSvgItemPI()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemPI* ElectricFunctionModelSvgItemPI::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemPI(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemPI::setImage_1(QFileInfo info)
|
void ElectricFunctionModelSvgItemPI::setImage_1(QFileInfo info)
|
||||||
{
|
{
|
||||||
QByteArray svgData;
|
QByteArray svgData;
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,23 @@ ElectricFunctionModelSvgItemPT::ElectricFunctionModelSvgItemPT(const QRect &rect
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemPT::ElectricFunctionModelSvgItemPT(const ElectricFunctionModelSvgItemPT& obj)
|
||||||
|
: ElectricFunctionModelSvgItem(obj)
|
||||||
|
{
|
||||||
|
initial();
|
||||||
|
_itemType = obj._itemType;
|
||||||
|
}
|
||||||
|
|
||||||
ElectricFunctionModelSvgItemPT::~ElectricFunctionModelSvgItemPT()
|
ElectricFunctionModelSvgItemPT::~ElectricFunctionModelSvgItemPT()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricFunctionModelSvgItemPT* ElectricFunctionModelSvgItemPT::clone() const
|
||||||
|
{
|
||||||
|
return new ElectricFunctionModelSvgItemPT(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void ElectricFunctionModelSvgItemPT::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
void ElectricFunctionModelSvgItemPT::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||||
{
|
{
|
||||||
if(_curMonitorStateEnable){
|
if(_curMonitorStateEnable){
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,22 @@ GraphicsFunctionModelItem::GraphicsFunctionModelItem(QGraphicsItem *parent)
|
||||||
m_eventExecutor = QSharedPointer<EventExecutor>(new EventExecutor());
|
m_eventExecutor = QSharedPointer<EventExecutor>(new EventExecutor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GraphicsFunctionModelItem::GraphicsFunctionModelItem(const GraphicsFunctionModelItem& obj)
|
||||||
|
: GraphicsProjectModelItem(obj)
|
||||||
|
,_pPropertyProxy(nullptr)
|
||||||
|
{
|
||||||
|
//只做基本拷贝,用在预览显示
|
||||||
|
}
|
||||||
|
|
||||||
GraphicsFunctionModelItem::~GraphicsFunctionModelItem()
|
GraphicsFunctionModelItem::~GraphicsFunctionModelItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GraphicsFunctionModelItem* GraphicsFunctionModelItem::clone() const
|
||||||
|
{
|
||||||
|
return new GraphicsFunctionModelItem(*this);
|
||||||
|
}
|
||||||
|
|
||||||
QMap<QString,bool> GraphicsFunctionModelItem::getMap()
|
QMap<QString,bool> GraphicsFunctionModelItem::getMap()
|
||||||
{
|
{
|
||||||
QMap<QString,bool> mapBool;
|
QMap<QString,bool> mapBool;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
PropertyDlg::PropertyDlg(QWidget *parent)
|
PropertyDlg::PropertyDlg(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
|
,_curWidget(nullptr)
|
||||||
{
|
{
|
||||||
setWindowTitle("属性显示");
|
setWindowTitle("属性显示");
|
||||||
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint );
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint );
|
||||||
|
|
@ -15,13 +16,17 @@ PropertyDlg::PropertyDlg(QWidget *parent)
|
||||||
|
|
||||||
PropertyDlg::~PropertyDlg()
|
PropertyDlg::~PropertyDlg()
|
||||||
{
|
{
|
||||||
|
if(_curWidget)
|
||||||
|
removeContent(_curWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyDlg::setContent(QWidget* content)
|
void PropertyDlg::setContent(QWidget* content)
|
||||||
{
|
{
|
||||||
if(content)
|
if(content){
|
||||||
|
if(_layout->count() == 0)
|
||||||
_layout->addWidget(content);
|
_layout->addWidget(content);
|
||||||
|
_curWidget = content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyDlg::removeContent(QWidget* content)
|
void PropertyDlg::removeContent(QWidget* content)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,254 @@
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include "selectPanel.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
#include "graphicsDataModel/fixedPortsModel.h"
|
||||||
|
#include "graphicsItem/graphicsBaseItem.h"
|
||||||
|
#include "util/selectorManager.h"
|
||||||
|
#include "powerEntity.h"
|
||||||
|
#include "topologyManager.h"
|
||||||
|
#include "baseProperty.h"
|
||||||
|
#include "graphicsItem/electricBayItem.h"
|
||||||
|
#include "statusBar.h"
|
||||||
|
#include "graphicsItem/functionModelItem/graphicsFunctionModelItem.h"
|
||||||
|
|
||||||
|
SelectPanel::SelectPanel(PowerEntity* pEntity,QWidget *parent,DiagramMode mode)
|
||||||
|
: BaseDrawingPanel(pEntity,parent,mode)
|
||||||
|
{
|
||||||
|
m_pStatusBar->setButtonVisible(false);
|
||||||
|
_pModel->setPanelMode(1); //设置为预览模式
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectPanel::~SelectPanel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject SelectPanel::getDiagramInfo()
|
||||||
|
{
|
||||||
|
QJsonObject obj;
|
||||||
|
QJsonArray arr;
|
||||||
|
if(_pModel)
|
||||||
|
{
|
||||||
|
QMap<QUuid,ItemPageInfo> map = _pModel->allNodePos();
|
||||||
|
for(auto iter = map.begin();iter != map.end();++iter)
|
||||||
|
{
|
||||||
|
QJsonObject node;
|
||||||
|
node["id"] = iter.key().toString();
|
||||||
|
node["x"] = iter.value().pos.x();
|
||||||
|
node["y"] = iter.value().pos.y();
|
||||||
|
node["width"] = iter.value().dWidth;
|
||||||
|
node["height"] = iter.value().dHeight;
|
||||||
|
node["rotate"] = iter.value().dRotate;
|
||||||
|
arr.append(node);
|
||||||
|
}
|
||||||
|
obj["nodes"] = arr;
|
||||||
|
|
||||||
|
QJsonArray arrConnect;
|
||||||
|
QVector<ModelProperty*> vec = _pModel->allConnectionProperty();
|
||||||
|
for(auto& pPro:vec){
|
||||||
|
Connection con = pPro->getConnection();
|
||||||
|
QJsonObject connect;
|
||||||
|
connect["id"] = pPro->uuid().toString();
|
||||||
|
connect["SrcNodeId"] = con.nSrcNodeId.toString();
|
||||||
|
connect["SrcPortId"] = con.nSrcPortId.toString();
|
||||||
|
connect["DestNodeId"] = con.nDestNodeId.toString();
|
||||||
|
connect["DestPortId"] = con.nDestPortId.toString();
|
||||||
|
arrConnect.append(connect);
|
||||||
|
}
|
||||||
|
obj["connections"] = arrConnect;
|
||||||
|
|
||||||
|
QJsonArray arrBay;
|
||||||
|
QMap<QUuid,ElectricBayItem*> mapBay = _pModel->allBayItem();
|
||||||
|
for(auto& bayItem:mapBay){
|
||||||
|
AbstractProperty* pPro = bayItem->getProperty();
|
||||||
|
BayProperty* pBay = dynamic_cast<BayProperty*>(pPro);
|
||||||
|
if(pBay)
|
||||||
|
{
|
||||||
|
QJsonObject bay;
|
||||||
|
bay["id"] = pBay->uuid().toString();
|
||||||
|
arrBay.append(bay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj["bays"] = arrBay;
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectPanel::loadNodes(QJsonObject obj)
|
||||||
|
{
|
||||||
|
QJsonArray nodesJsonArray = obj["nodes"].toArray();
|
||||||
|
|
||||||
|
QList<QPair<QString,QUuid>> lst;
|
||||||
|
for (QJsonValueRef nodeJson : nodesJsonArray)
|
||||||
|
{
|
||||||
|
QJsonObject node = nodeJson.toObject();
|
||||||
|
QString uuid = node["id"].toString();
|
||||||
|
double dX = node["x"].toDouble();
|
||||||
|
double dY = node["y"].toDouble();
|
||||||
|
double dWidth = node["width"].toDouble();
|
||||||
|
double dHeight = node["height"].toDouble();
|
||||||
|
double dRotate = node["rotate"].toDouble();
|
||||||
|
|
||||||
|
if(_pModel)
|
||||||
|
{
|
||||||
|
auto pItem = _pModel->addNodeItem(QUuid(uuid),QPointF(dX,dY),dWidth,dHeight,dRotate);
|
||||||
|
if(pItem){
|
||||||
|
lst.append(qMakePair(pItem->getName(),QUuid(uuid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonArray connectArr = obj["connections"].toArray();
|
||||||
|
for(QJsonValueRef connectJson:connectArr)
|
||||||
|
{
|
||||||
|
QJsonObject connect = connectJson.toObject();
|
||||||
|
QUuid id = QUuid(connect["id"].toString()); //电缆线id,关联component中的电缆
|
||||||
|
QUuid srcId = QUuid(connect["SrcNodeId"].toString());
|
||||||
|
QUuid srcPortId = QUuid(connect["SrcPortId"].toString());
|
||||||
|
QUuid destId = QUuid(connect["DestNodeId"].toString());
|
||||||
|
QUuid destPortId = QUuid(connect["DestPortId"].toString());
|
||||||
|
|
||||||
|
PowerConnection* pCon = TopologyManager::instance().connection(srcPortId.toString(),destPortId.toString());
|
||||||
|
if(pCon)
|
||||||
|
{
|
||||||
|
pCon->setId(id.toString());
|
||||||
|
QString srcItemId = pCon->fromComponent();
|
||||||
|
QString destItemId = pCon->toComponent();
|
||||||
|
//todo:从拓扑结构中查找port的id
|
||||||
|
if(_pModel)
|
||||||
|
{
|
||||||
|
QString sName = _pModel->addConnectLline(id,QUuid(srcItemId),QUuid(destItemId),srcPortId,destPortId);
|
||||||
|
if(sName != "err"){
|
||||||
|
lst.append(qMakePair(sName,QUuid(id)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//todo:提示拓扑结构已改变
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonArray bayArr = obj["bays"].toArray();
|
||||||
|
for(QJsonValueRef bayJson:bayArr)
|
||||||
|
{
|
||||||
|
QJsonObject bay = bayJson.toObject();
|
||||||
|
QUuid id = QUuid(bay["id"].toString());
|
||||||
|
if(_pModel)
|
||||||
|
{
|
||||||
|
_pModel->addBayItem(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_pModel){
|
||||||
|
QString sG;
|
||||||
|
QString sZ;
|
||||||
|
QString sS;
|
||||||
|
for(auto& pBaseItem:_pModel->allItems()) //取grid_zone_station(间隔不含这些内容)
|
||||||
|
{
|
||||||
|
BaseProperty* pBase = dynamic_cast<BaseProperty*>(pBaseItem->getProperty());
|
||||||
|
if(sG.isEmpty())
|
||||||
|
sG = pBase->grid();
|
||||||
|
if(sZ.isEmpty())
|
||||||
|
sZ = pBase->zone();
|
||||||
|
if(sS.isEmpty())
|
||||||
|
sS = pBase->station();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<HierarchyItem> lstFirst;
|
||||||
|
|
||||||
|
for(auto& pOtherItem:_pModel->getProjectBayItems())
|
||||||
|
{
|
||||||
|
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||||
|
if(pBay){
|
||||||
|
// 创建间隔项
|
||||||
|
HierarchyItem bayInfo;
|
||||||
|
bayInfo.item.nEquipType = 0; // 间隔的设备类型为0
|
||||||
|
bayInfo.item.nCategory = 1; // 类别为1表示间隔
|
||||||
|
bayInfo.item.sName = pBay->tag();
|
||||||
|
bayInfo.item.uid = pBay->uuid();
|
||||||
|
bayInfo.item.sVoltageLevel = QString::number(pBay->getVoltage());
|
||||||
|
bayInfo.item.grid = sG;
|
||||||
|
bayInfo.item.zone = sZ;
|
||||||
|
bayInfo.item.station = sS;
|
||||||
|
|
||||||
|
lstFirst.append(bayInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
emit _pModel->updateCurrentItems(lstFirst, true);
|
||||||
|
emit _pModel->updateTopologyItems(lstFirst, true,true);
|
||||||
|
|
||||||
|
// 第二阶段:处理所有设备
|
||||||
|
QList<HierarchyItem> lstSecond;
|
||||||
|
|
||||||
|
// 建立间隔UUID到间隔标签的映射,提高查找效率
|
||||||
|
QHash<QString, QString> bayUuidToTag;
|
||||||
|
for(auto& pOtherItem:_pModel->getProjectBayItems())
|
||||||
|
{
|
||||||
|
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||||
|
if(pBay){
|
||||||
|
bayUuidToTag[pBay->uuid().toString()] = pBay->tag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto& pBaseItem:_pModel->allItems())
|
||||||
|
{
|
||||||
|
BaseProperty* pBase = dynamic_cast<BaseProperty*>(pBaseItem->getProperty());
|
||||||
|
|
||||||
|
HierarchyItem info;
|
||||||
|
info.item.nEquipType = pBase->type();
|
||||||
|
info.item.nCategory = 0; // 类别为0表示设备
|
||||||
|
info.item.sName = pBase->name();
|
||||||
|
info.item.uid = pBase->uuid();
|
||||||
|
|
||||||
|
// 查找设备所属的间隔
|
||||||
|
QString bayTag;
|
||||||
|
QString bayUuid;
|
||||||
|
QString sVoltage;
|
||||||
|
|
||||||
|
// 通过间隔标签直接查找
|
||||||
|
bayTag = pBase->getBay();
|
||||||
|
|
||||||
|
// 如果需要间隔UUID,可以反向查找
|
||||||
|
if(!bayTag.isEmpty()){
|
||||||
|
for(auto& pOtherItem:_pModel->getProjectBayItems()){
|
||||||
|
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||||
|
if(pBay && pBay->tag() == bayTag){
|
||||||
|
bayUuid = pBay->uuid().toString();
|
||||||
|
sVoltage = QString::number(pBay->getVoltage());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bayTag.isEmpty()){
|
||||||
|
// 设置父间隔信息
|
||||||
|
info.parent.nEquipType = 0;
|
||||||
|
info.parent.nCategory = 1;
|
||||||
|
info.parent.sName = bayTag;
|
||||||
|
info.parent.uid = QUuid(bayUuid);
|
||||||
|
info.parent.sVoltageLevel = sVoltage;
|
||||||
|
info.parent.grid = sG;
|
||||||
|
info.parent.zone = sZ;
|
||||||
|
info.parent.station = sS;
|
||||||
|
}
|
||||||
|
|
||||||
|
lstSecond.append(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit _pModel->updateCurrentItems(lstSecond, false);
|
||||||
|
emit _pModel->updateTopologyItems(lstSecond, false,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectPanel::clearItems()
|
||||||
|
{
|
||||||
|
if(_pModel){
|
||||||
|
_pModel->getScene()->clear();
|
||||||
|
_pModel->allItems().clear();
|
||||||
|
_pModel->getProjectBayItems().clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -276,6 +276,34 @@ void BaseSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScen
|
||||||
view->setDragMode(QGraphicsView::RubberBandDrag);
|
view->setDragMode(QGraphicsView::RubberBandDrag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(sceneMode == DM_customHMI){
|
||||||
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
if(items.count() != 0){
|
||||||
|
for(auto& pI:items){
|
||||||
|
GraphicsFunctionModelItem* item = qgraphicsitem_cast<GraphicsFunctionModelItem*>(pI);
|
||||||
|
if(item)
|
||||||
|
item->setSelected(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF pos = event->scenePos();
|
||||||
|
for (QGraphicsItem* item : scene->items()) { //检测间隔
|
||||||
|
ElectricBayItem* pItem = dynamic_cast<ElectricBayItem*>(item);
|
||||||
|
if (pItem) {
|
||||||
|
if(pItem->containsPoint(pos)){
|
||||||
|
// 处理命中
|
||||||
|
pItem->setSelected(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_opMode = OM_none;
|
||||||
|
if(m_opMode == OM_none)
|
||||||
|
{
|
||||||
|
QGraphicsView *view = scene->getView();
|
||||||
|
if(view)
|
||||||
|
view->setDragMode(QGraphicsView::RubberBandDrag);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
void BaseSelector::mouseMoveEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
|
|
@ -533,6 +561,40 @@ void BaseSelector::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, DesignerSc
|
||||||
ms_nDragHandle = H_none;
|
ms_nDragHandle = H_none;
|
||||||
scene->callParentEvent(event);
|
scene->callParentEvent(event);
|
||||||
}
|
}
|
||||||
|
else if(sceneMode == DM_customHMI)
|
||||||
|
{
|
||||||
|
QList<HierarchyItem> lst; //发送已选中的元件
|
||||||
|
QList<QGraphicsItem *> items = scene->selectedItems();
|
||||||
|
for(auto& pItem:items){
|
||||||
|
GraphicsFunctionModelItem* item = dynamic_cast<GraphicsFunctionModelItem*>(pItem);
|
||||||
|
if(item){
|
||||||
|
HierarchyItem info;
|
||||||
|
auto pPro = item->getProperty();
|
||||||
|
if(pPro){
|
||||||
|
info.item.nCategory = 0;
|
||||||
|
info.item.nEquipType = pPro->type();
|
||||||
|
info.item.sName = pPro->name();
|
||||||
|
info.item.uid = pPro->uuid();
|
||||||
|
lst.append(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
GraphicsNonStandardItem* bay = dynamic_cast<GraphicsNonStandardItem*>(pItem);
|
||||||
|
if(bay){
|
||||||
|
HierarchyItem info;
|
||||||
|
auto pBayPro = bay->getProperty();
|
||||||
|
if(pBayPro){
|
||||||
|
info.item.nCategory = 1;
|
||||||
|
info.item.nEquipType = 0;
|
||||||
|
info.item.sName = pBayPro->name();
|
||||||
|
info.item.uid = pBayPro->uuid();
|
||||||
|
lst.append(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit _model->itemSelected(lst);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseSelector::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
void BaseSelector::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event, DesignerScene* scene,DiagramMode sceneMode)
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,81 @@ QWidget QLabel {
|
||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>15</number>
|
<number>15</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="cb_structure">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>无</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="btn_custom">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton {
|
||||||
|
background-color: #5a79a1; /* 中性灰蓝,不刺眼 */
|
||||||
|
color: white;
|
||||||
|
border: none; /* 无边框,扁平化 */
|
||||||
|
border-radius: 4px; /* 小圆角,扁平感 */
|
||||||
|
font-size: 13px; /* 适中字号 */
|
||||||
|
font-weight: 500; /* 中等字重 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #4a5d7e; /* 稍深的灰蓝 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:pressed {
|
||||||
|
background-color: #3d4e6b; /* 更深的灰蓝 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:disabled {
|
||||||
|
background-color: #a0b3d1; /* 灰调的浅蓝 */
|
||||||
|
color: #d1dce9; /* 浅灰色文字 */
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>自定义导入</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit"/>
|
||||||
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="cb_template">
|
<widget class="QComboBox" name="cb_template">
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -135,39 +210,7 @@ QWidget QLabel {
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="5" column="1">
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>导入:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="cb_structure">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>无</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLabel" name="label_info">
|
<widget class="QLabel" name="label_info">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,394 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>customHMIGenerateDlg</class>
|
||||||
|
<widget class="QDialog" name="customHMIGenerateDlg">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>935</width>
|
||||||
|
<height>667</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout" rowstretch="1,5,5,4" columnstretch="3,2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>21</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QWidget {
|
||||||
|
background: #2c5282;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget QLabel {
|
||||||
|
color: white;
|
||||||
|
font-size: 12px;
|
||||||
|
background: transparent;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>自定义生成</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>586</width>
|
||||||
|
<height>6</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" rowspan="2">
|
||||||
|
<widget class="QGroupBox" name="gb_sys">
|
||||||
|
<property name="title">
|
||||||
|
<string>系统图工作区</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QGroupBox" name="gb_list">
|
||||||
|
<property name="title">
|
||||||
|
<string>对象列表</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QGroupBox" name="gb_preview">
|
||||||
|
<property name="title">
|
||||||
|
<string>效果预览</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QGroupBox" name="gb_command">
|
||||||
|
<property name="title">
|
||||||
|
<string>控制面板</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>布局模式</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rb_origin">
|
||||||
|
<property name="text">
|
||||||
|
<string>相对位置</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rb_auto">
|
||||||
|
<property name="text">
|
||||||
|
<string>自动优化</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>HMI名称</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="le_hmiName"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>尺寸</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cb_size">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>90</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1920*1080</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1600*1200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1280*960</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>800*600</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>400*300</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_return">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton {
|
||||||
|
background-color: #5a79a1; /* 中性灰蓝,不刺眼 */
|
||||||
|
color: white;
|
||||||
|
border: none; /* 无边框,扁平化 */
|
||||||
|
border-radius: 4px; /* 小圆角,扁平感 */
|
||||||
|
font-size: 13px; /* 适中字号 */
|
||||||
|
font-weight: 500; /* 中等字重 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #4a5d7e; /* 稍深的灰蓝 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:pressed {
|
||||||
|
background-color: #3d4e6b; /* 更深的灰蓝 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:disabled {
|
||||||
|
background-color: #a0b3d1; /* 灰调的浅蓝 */
|
||||||
|
color: #d1dce9; /* 浅灰色文字 */
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>返回</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_generate">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton {
|
||||||
|
background-color: #5a79a1; /* 中性灰蓝,不刺眼 */
|
||||||
|
color: white;
|
||||||
|
border: none; /* 无边框,扁平化 */
|
||||||
|
border-radius: 4px; /* 小圆角,扁平感 */
|
||||||
|
font-size: 13px; /* 适中字号 */
|
||||||
|
font-weight: 500; /* 中等字重 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #4a5d7e; /* 稍深的灰蓝 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:pressed {
|
||||||
|
background-color: #3d4e6b; /* 更深的灰蓝 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:disabled {
|
||||||
|
background-color: #a0b3d1; /* 灰调的浅蓝 */
|
||||||
|
color: #d1dce9; /* 浅灰色文字 */
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>生成</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_7">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -36,34 +36,27 @@ void Logger::initialize()
|
||||||
|
|
||||||
void Logger::loadConfig(/*const QString& configFilePath*/)
|
void Logger::loadConfig(/*const QString& configFilePath*/)
|
||||||
{
|
{
|
||||||
//QString filePath = Settings::instance().value("Log", "logFile").toString();
|
|
||||||
QString filePath = QCoreApplication::applicationDirPath() + "/log/app.log";
|
QString filePath = QCoreApplication::applicationDirPath() + "/log/app.log";
|
||||||
|
|
||||||
|
// 确保日志目录存在
|
||||||
|
QDir logDir(QFileInfo(filePath).absolutePath());
|
||||||
|
if (!logDir.exists()) {
|
||||||
|
logDir.mkpath("."); // 创建目录
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件是否存在,不存在则创建
|
||||||
|
QFile logFile(filePath);
|
||||||
|
if (!logFile.exists()) {
|
||||||
|
if (logFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
||||||
|
logFile.close();
|
||||||
|
} else {
|
||||||
|
// 处理创建失败的情况
|
||||||
|
qWarning() << "Failed to create log file:" << filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setLogFile(filePath);
|
setLogFile(filePath);
|
||||||
|
|
||||||
/*QString strLevel = Settings::instance().value("Log", "level").toString().toUpper();
|
|
||||||
if(strLevel == "DEBUG")
|
|
||||||
m_logLevel = DEBUG;
|
|
||||||
else if(strLevel == "INFO")
|
|
||||||
m_logLevel = INFO;
|
|
||||||
else if(strLevel == "WARNING")
|
|
||||||
m_logLevel = WARNING;
|
|
||||||
else if(strLevel == "ERROR")
|
|
||||||
m_logLevel = ERROR;
|
|
||||||
else if(strLevel == "FATAL")
|
|
||||||
m_logLevel = FATAL;
|
|
||||||
|
|
||||||
m_maxFileSize = Settings::instance().value("Log", "maxSize").toLongLong();
|
|
||||||
m_maxBackupFiles = Settings::instance().value("Log", "backups").toInt();
|
|
||||||
QString strOutputToConsole = Settings::instance().value("Log", "consoleOutput").toString();
|
|
||||||
if(strOutputToConsole == "true")
|
|
||||||
m_outputToConsole = true;
|
|
||||||
else
|
|
||||||
m_outputToConsole = false;
|
|
||||||
QString strOutputToFile = Settings::instance().value("Log", "fileOutput").toString();
|
|
||||||
if(strOutputToFile == "true")
|
|
||||||
m_outputOtFile = true;
|
|
||||||
else
|
|
||||||
m_outputOtFile = false;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::setLogFile(const QString& filePath)
|
void Logger::setLogFile(const QString& filePath)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class MonitorItemsDlg;
|
||||||
class MonitorPagesDlg;
|
class MonitorPagesDlg;
|
||||||
class QDetailsView;
|
class QDetailsView;
|
||||||
class RuntimeDialog;
|
class RuntimeDialog;
|
||||||
|
class QQuickWidget;
|
||||||
|
|
||||||
class CMainWindow : public QMainWindow
|
class CMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
|
|
@ -52,6 +53,7 @@ private slots:
|
||||||
void onSignal_deleteItem();
|
void onSignal_deleteItem();
|
||||||
|
|
||||||
void onCavasItemSelected(QObject*);
|
void onCavasItemSelected(QObject*);
|
||||||
|
void clearPropertySelection();
|
||||||
public:
|
public:
|
||||||
GraphicElementsPanel* graphicsElementsPanel() const;
|
GraphicElementsPanel* graphicsElementsPanel() const;
|
||||||
void setMode(int nMode = 0); //切换模式
|
void setMode(int nMode = 0); //切换模式
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,15 @@ public:
|
||||||
RuntimeDialog(QWidget* parent = nullptr);
|
RuntimeDialog(QWidget* parent = nullptr);
|
||||||
|
|
||||||
void setContent(QWidget* content);
|
void setContent(QWidget* content);
|
||||||
|
void removeContent(QWidget* content);
|
||||||
|
QWidget* content() {return _pContent;}
|
||||||
signals:
|
signals:
|
||||||
void exitRuntime();
|
void exitRuntime();
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* _layout;
|
QVBoxLayout* _layout;
|
||||||
|
QWidget* _pContent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //RUNTIMEDIALOG_H
|
#endif //RUNTIMEDIALOG_H
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QLibrary>
|
#include <QLibrary>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include "diagramCavas.h"
|
#include "diagramCavas.h"
|
||||||
#include "graphicElementsPanel.h"
|
#include "graphicElementsPanel.h"
|
||||||
|
|
@ -62,6 +64,8 @@ CMainWindow::~CMainWindow()
|
||||||
delete pView;
|
delete pView;
|
||||||
delete m_pPropertiesEditorView;
|
delete m_pPropertiesEditorView;
|
||||||
}
|
}
|
||||||
|
if(m_pRuntimeDlg)
|
||||||
|
delete m_pRuntimeDlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -136,9 +140,10 @@ void CMainWindow::initializeDockUi()
|
||||||
this->setCentralWidget(m_pDiagramCavas);
|
this->setCentralWidget(m_pDiagramCavas);
|
||||||
connect(m_pElectricElementsBox,&ElectricElementsBox::addEletricItem,m_pDiagramCavas,&DiagramCavas::onSignal_addGraphicsItem);
|
connect(m_pElectricElementsBox,&ElectricElementsBox::addEletricItem,m_pDiagramCavas,&DiagramCavas::onSignal_addGraphicsItem);
|
||||||
|
|
||||||
m_pRuntimeDlg = new RuntimeDialog(this);
|
m_pRuntimeDlg = new RuntimeDialog();
|
||||||
m_pRuntimeDlg->hide();
|
m_pRuntimeDlg->hide();
|
||||||
connect(m_pRuntimeDlg,&RuntimeDialog::exitRuntime,this,[&](){
|
connect(m_pRuntimeDlg,&RuntimeDialog::exitRuntime,this,[&](){
|
||||||
|
//m_pDiagramCavas->onTargetSelected(new QObject(m_pDiagramCavas));
|
||||||
setMode(0);
|
setMode(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -193,6 +198,7 @@ void CMainWindow::initializeAction()
|
||||||
connect(m_pDiagramView,&DiagramView::prepareCreateHMI,m_pDiagramCavas,&DiagramCavas::onCreateHMIClicked);
|
connect(m_pDiagramView,&DiagramView::prepareCreateHMI,m_pDiagramCavas,&DiagramCavas::onCreateHMIClicked);
|
||||||
connect(m_pDiagramCavas,&DiagramCavas::createHMI,m_pDiagramView,&DiagramView::onNewHMICreated);
|
connect(m_pDiagramCavas,&DiagramCavas::createHMI,m_pDiagramView,&DiagramView::onNewHMICreated);
|
||||||
connect(m_pDiagramCavas,&DiagramCavas::updateHMI,m_pDiagramView,&DiagramView::onHMIUpdated);
|
connect(m_pDiagramCavas,&DiagramCavas::updateHMI,m_pDiagramView,&DiagramView::onHMIUpdated);
|
||||||
|
connect(m_pDiagramCavas, &DiagramCavas::clearSelection,this, &CMainWindow::clearPropertySelection);
|
||||||
|
|
||||||
//connect(m_pDiagramCavas,&DiagramCavas::prepareUpdateItems,m_pMonitorItemsDlg,&MonitorItemsDlg::onUpdateItems);
|
//connect(m_pDiagramCavas,&DiagramCavas::prepareUpdateItems,m_pMonitorItemsDlg,&MonitorItemsDlg::onUpdateItems);
|
||||||
//connect(m_pDiagramCavas,&DiagramCavas::prepareSelectItems,m_pMonitorItemsDlg,&MonitorItemsDlg::onSelectItems);
|
//connect(m_pDiagramCavas,&DiagramCavas::prepareSelectItems,m_pMonitorItemsDlg,&MonitorItemsDlg::onSelectItems);
|
||||||
|
|
@ -213,6 +219,7 @@ void CMainWindow::initializeAction()
|
||||||
actRun->setShortcut(QKeySequence(Qt::Key_F5));
|
actRun->setShortcut(QKeySequence(Qt::Key_F5));
|
||||||
//connect(actRun,&QAction::triggered,m_pDiagramCavas,&DiagramCavas::onSignal_runPage);
|
//connect(actRun,&QAction::triggered,m_pDiagramCavas,&DiagramCavas::onSignal_runPage);
|
||||||
connect(actRun,&QAction::triggered,this,[&](){
|
connect(actRun,&QAction::triggered,this,[&](){
|
||||||
|
//m_pDiagramCavas->onTargetSelected(new QObject(m_pDiagramCavas));
|
||||||
setMode(1);
|
setMode(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -249,18 +256,25 @@ void CMainWindow::initializeAction()
|
||||||
|
|
||||||
void CMainWindow::refreshLayout()
|
void CMainWindow::refreshLayout()
|
||||||
{
|
{
|
||||||
if(_nMode == 0){ //编辑模式
|
if (_nMode == 0) { // 编辑模式
|
||||||
m_pRuntimeDlg->hide();
|
m_pRuntimeDlg->hide();
|
||||||
|
m_pRuntimeDlg->removeContent(m_pDiagramCavas);
|
||||||
|
|
||||||
this->show();
|
this->show();
|
||||||
this->setCentralWidget(m_pDiagramCavas);
|
this->setCentralWidget(m_pDiagramCavas);
|
||||||
}
|
}
|
||||||
else{
|
else { // 运行模式
|
||||||
|
if (centralWidget() == m_pDiagramCavas) {
|
||||||
|
this->takeCentralWidget();
|
||||||
|
}
|
||||||
this->hide();
|
this->hide();
|
||||||
|
|
||||||
m_pRuntimeDlg->setContent(m_pDiagramCavas);
|
m_pRuntimeDlg->setContent(m_pDiagramCavas);
|
||||||
m_pRuntimeDlg->showMaximized();
|
m_pRuntimeDlg->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMainWindow::onAction_zoomIn()
|
void CMainWindow::onAction_zoomIn()
|
||||||
{
|
{
|
||||||
//m_pDrawingPanel->grahpicsViewZoomIn();
|
//m_pDrawingPanel->grahpicsViewZoomIn();
|
||||||
|
|
@ -342,6 +356,13 @@ void CMainWindow::onCavasItemSelected(QObject* obj)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMainWindow::clearPropertySelection()
|
||||||
|
{
|
||||||
|
if (m_pPropertiesEditorView) {
|
||||||
|
m_pPropertiesEditorView->setObject(new QObject(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GraphicElementsPanel* CMainWindow::graphicsElementsPanel() const
|
GraphicElementsPanel* CMainWindow::graphicsElementsPanel() const
|
||||||
{
|
{
|
||||||
if(m_pGraphicElementsPanel)
|
if(m_pGraphicElementsPanel)
|
||||||
|
|
@ -357,12 +378,8 @@ void CMainWindow::setMode(int nMode)
|
||||||
{
|
{
|
||||||
if(_nMode != nMode){
|
if(_nMode != nMode){
|
||||||
_nMode = nMode;
|
_nMode = nMode;
|
||||||
m_pPropertyEditorDock->setWidget(nullptr);
|
|
||||||
m_pDiagramCavas->setCurMode(nMode);
|
m_pDiagramCavas->setCurMode(nMode);
|
||||||
}
|
}
|
||||||
if(_nMode == 0){
|
|
||||||
m_pPropertyEditorDock->setWidget(m_pPropertiesEditorView); //属性页设置回主界面
|
|
||||||
}
|
|
||||||
refreshLayout();
|
refreshLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
RuntimeDialog::RuntimeDialog(QWidget *parent)
|
RuntimeDialog::RuntimeDialog(QWidget *parent)
|
||||||
: QDialog(parent,Qt::FramelessWindowHint)
|
: QDialog(parent)
|
||||||
|
,_pContent(nullptr)
|
||||||
{
|
{
|
||||||
_layout = new QVBoxLayout(this);
|
_layout = new QVBoxLayout(this);
|
||||||
_layout->setContentsMargins(0, 0, 0, 0);
|
_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
@ -20,4 +21,13 @@ void RuntimeDialog::setContent(QWidget* content)
|
||||||
{
|
{
|
||||||
if(content)
|
if(content)
|
||||||
_layout->addWidget(content);
|
_layout->addWidget(content);
|
||||||
|
_pContent = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RuntimeDialog::removeContent(QWidget* content)
|
||||||
|
{
|
||||||
|
if(content){
|
||||||
|
if(_layout->count())
|
||||||
|
_layout->removeWidget(content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue