add monitor para show dlg
This commit is contained in:
parent
4dab56f285
commit
fb814b65a5
|
|
@ -15,6 +15,7 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/monitorAttributeDlg.h
|
include/monitorAttributeDlg.h
|
||||||
include/monitorAttributeGroupDlg.h
|
include/monitorAttributeGroupDlg.h
|
||||||
include/monitorConfigDlg.h
|
include/monitorConfigDlg.h
|
||||||
|
include/monitorDetailAttributeDlg.h
|
||||||
include/itemPropertyDlg.h
|
include/itemPropertyDlg.h
|
||||||
include/propertyContentDlg.h
|
include/propertyContentDlg.h
|
||||||
include/serializable.h
|
include/serializable.h
|
||||||
|
|
@ -131,6 +132,7 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/monitorAttributeDlg.cpp
|
source/monitorAttributeDlg.cpp
|
||||||
source/monitorAttributeGroupDlg.cpp
|
source/monitorAttributeGroupDlg.cpp
|
||||||
source/monitorConfigDlg.cpp
|
source/monitorConfigDlg.cpp
|
||||||
|
source/monitorDetailAttributeDlg.cpp
|
||||||
source/itemPropertyDlg.cpp
|
source/itemPropertyDlg.cpp
|
||||||
source/propertyContentDlg.cpp
|
source/propertyContentDlg.cpp
|
||||||
source/statusBar.cpp
|
source/statusBar.cpp
|
||||||
|
|
@ -250,6 +252,7 @@ set(UI_FILES
|
||||||
ui/confirmEditorDlg.ui
|
ui/confirmEditorDlg.ui
|
||||||
ui/projectIconSetting.ui
|
ui/projectIconSetting.ui
|
||||||
ui/monitorConfigDlg.ui
|
ui/monitorConfigDlg.ui
|
||||||
|
ui/monitorDetailAttributeDlg.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,9 @@ public:
|
||||||
void generateMonitor(QString,QList<monitorRelationItem>); //生成监控 (监控名,选中的设备列表)
|
void generateMonitor(QString,QList<monitorRelationItem>); //生成监控 (监控名,选中的设备列表)
|
||||||
void generateMonitorConfig(MonitorPanel*); //生成监控配置参数结构
|
void generateMonitorConfig(MonitorPanel*); //生成监控配置参数结构
|
||||||
QMap<QUuid,QList<monitorItemAttributeInfo>>& getMonitorPara() {return m_monitorPara;}
|
QMap<QUuid,QList<monitorItemAttributeInfo>>& getMonitorPara() {return m_monitorPara;}
|
||||||
|
|
||||||
|
void monitorItemSelected(QUuid); //运行时item选中事件
|
||||||
|
void monitorItemDetailAttr(QUuid); //显示属性详情
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void activatePage(const QString&); //激活当前model所在page
|
void activatePage(const QString&); //激活当前model所在page
|
||||||
void updateCurrentItems(QList<monitorRelationItem>,bool); //更新当前组态元件列表 <名称,uid>
|
void updateCurrentItems(QList<monitorRelationItem>,bool); //更新当前组态元件列表 <名称,uid>
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,12 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
class MonitorToolBox;
|
class MonitorToolBox;
|
||||||
|
class MonitorAttributeGroupDlg;
|
||||||
|
class MonitorSideBarDlg;
|
||||||
|
struct monitorItemAttributeInfo;
|
||||||
|
|
||||||
class MonitorAttributeDlg : public QDialog
|
class MonitorAttributeDlg : public QDialog
|
||||||
{
|
{
|
||||||
|
|
@ -14,10 +18,15 @@ public:
|
||||||
~MonitorAttributeDlg();
|
~MonitorAttributeDlg();
|
||||||
|
|
||||||
void initial();
|
void initial();
|
||||||
void setCurAttribute(MonitorToolBox*); //设置当前显示的属性对象
|
void generateAttributeGroups(QUuid);
|
||||||
void clearCurAttribute(); //清空属性对象
|
MonitorSideBarDlg* getParent(){return _pParent;}
|
||||||
|
QUuid getCurId() {return _curId;}
|
||||||
|
void clearAllGroup();
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* _pLayout;
|
QVBoxLayout* _pLayout;
|
||||||
|
MonitorToolBox* _pBox;
|
||||||
|
QUuid _curId;
|
||||||
|
MonitorSideBarDlg* _pParent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,13 @@
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
class MonitorAttributeDlg;
|
||||||
|
struct monitorItemAttributeInfo;
|
||||||
|
class QChartView;
|
||||||
|
class QLabel;
|
||||||
|
class FixedPortsModel;
|
||||||
|
class MonitorDetailAttributeDlg;
|
||||||
|
|
||||||
class MonitorAttributeGroupDlg : public QScrollArea
|
class MonitorAttributeGroupDlg : public QScrollArea
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
@ -13,9 +20,22 @@ public:
|
||||||
~MonitorAttributeGroupDlg();
|
~MonitorAttributeGroupDlg();
|
||||||
|
|
||||||
void initial();
|
void initial();
|
||||||
void createGroupView();
|
void createGroupView(QList<monitorItemAttributeInfo>);
|
||||||
|
void setParent(MonitorAttributeDlg* p) {_pParent = p;}
|
||||||
|
void setDetailParent(MonitorDetailAttributeDlg* p){_pDetailParent = p;}
|
||||||
|
void setCurMode(int n) {_curMode = n;}
|
||||||
|
private:
|
||||||
|
QWidget* createEditor(monitorItemAttributeInfo);
|
||||||
|
void updateLineChartData(QChartView* chartView, const QVector<QPointF>& data);
|
||||||
|
void updateData(); //使用数据更新当前界面
|
||||||
|
FixedPortsModel* getModelController();
|
||||||
|
QUuid getCurUid();
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* _layout;
|
QVBoxLayout* _layout;
|
||||||
|
MonitorAttributeDlg* _pParent;
|
||||||
|
MonitorDetailAttributeDlg* _pDetailParent;
|
||||||
|
QMap<QString,QWidget*> _curWidget; //当前控件
|
||||||
|
int _curMode; //0简略模式 1详细模式
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef MONITORDETAILATTRIBUTEDLG_H
|
||||||
|
#define MONITORDETAILATTRIBUTEDLG_H
|
||||||
|
|
||||||
|
/******************监控属性详情页*********************/
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class monitorDetailAttributeDlg; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class QGridLayout;
|
||||||
|
class MonitorAttributeGroupDlg;
|
||||||
|
class MonitorPanel;
|
||||||
|
|
||||||
|
class MonitorDetailAttributeDlg : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MonitorDetailAttributeDlg(QWidget *parent = nullptr);
|
||||||
|
~MonitorDetailAttributeDlg();
|
||||||
|
|
||||||
|
void initial();
|
||||||
|
void generateAttributeGroups(QUuid uid);
|
||||||
|
void updateLayout(int columns);
|
||||||
|
MonitorPanel* getParent() {return _pParent;}
|
||||||
|
QUuid getCurId() {return _curId;}
|
||||||
|
void clearAllGroup();
|
||||||
|
public slots:
|
||||||
|
void onCloseClicked();
|
||||||
|
void onColChanged(const QString&);
|
||||||
|
private:
|
||||||
|
Ui::monitorDetailAttributeDlg *ui;
|
||||||
|
int _curColNum; //当前每行的列数
|
||||||
|
QGridLayout* m_gridLayout;
|
||||||
|
QMap<QString,MonitorAttributeGroupDlg*> _curGroups;
|
||||||
|
MonitorPanel* _pParent;
|
||||||
|
QUuid _curId;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
class PowerEntity;
|
class PowerEntity;
|
||||||
class MonitorSideBarDlg;
|
class MonitorSideBarDlg;
|
||||||
class MonitorConfigDlg;
|
class MonitorConfigDlg;
|
||||||
|
class MonitorDetailAttributeDlg;
|
||||||
|
|
||||||
class MonitorPanel : public BaseDrawingPanel
|
class MonitorPanel : public BaseDrawingPanel
|
||||||
{
|
{
|
||||||
|
|
@ -28,6 +29,8 @@ public:
|
||||||
|
|
||||||
QStandardItemModel* getLstModel() {return _itemListmodel;}
|
QStandardItemModel* getLstModel() {return _itemListmodel;}
|
||||||
void initMonitorConfig(); //初始化参数设置(每个运行时可能不同)
|
void initMonitorConfig(); //初始化参数设置(每个运行时可能不同)
|
||||||
|
void itemSelected(QUuid); //item选中事件
|
||||||
|
void detailItemSelected(QUuid); //显示详细属性页
|
||||||
public slots:
|
public slots:
|
||||||
void onRunClicked();
|
void onRunClicked();
|
||||||
void onStopClicked();
|
void onStopClicked();
|
||||||
|
|
@ -43,6 +46,8 @@ private:
|
||||||
MonitorSideBarDlg* _sideBar;
|
MonitorSideBarDlg* _sideBar;
|
||||||
MonitorConfigDlg* _pConfigDlg;
|
MonitorConfigDlg* _pConfigDlg;
|
||||||
QStandardItemModel* _itemListmodel;
|
QStandardItemModel* _itemListmodel;
|
||||||
|
MonitorDetailAttributeDlg* _detailAttributeDlg;
|
||||||
|
QMenu* _menuSetting;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
struct monitorRelationItem;
|
struct monitorRelationItem;
|
||||||
class MonitorSideBarDlg;
|
class MonitorSideBarDlg;
|
||||||
|
class QVBoxLayout;
|
||||||
|
|
||||||
class MonitorSelectedItemsDlg : public QDialog
|
class MonitorSelectedItemsDlg : public QDialog
|
||||||
{
|
{
|
||||||
|
|
@ -17,9 +18,12 @@ public:
|
||||||
|
|
||||||
void initial();
|
void initial();
|
||||||
void updateItems();
|
void updateItems();
|
||||||
|
public slots:
|
||||||
|
void onSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous); //属性选中事件
|
||||||
private:
|
private:
|
||||||
QTreeView* _treeView;
|
QTreeView* _treeView;
|
||||||
MonitorSideBarDlg* _parent;
|
MonitorSideBarDlg* _parent;
|
||||||
|
QVBoxLayout* _pLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ public:
|
||||||
void initial();
|
void initial();
|
||||||
MonitorPanel* getParent() {return _parent;}
|
MonitorPanel* getParent() {return _parent;}
|
||||||
MonitorSelectedItemsDlg* getItemsDlg() {return _itemsDlg;}
|
MonitorSelectedItemsDlg* getItemsDlg() {return _itemsDlg;}
|
||||||
|
MonitorAttributeDlg* getAttributeDlg() {return _attributeDlg;}
|
||||||
private:
|
private:
|
||||||
MonitorSelectedItemsDlg* _itemsDlg;
|
MonitorSelectedItemsDlg* _itemsDlg;
|
||||||
MonitorAttributeDlg* _attributeDlg;
|
MonitorAttributeDlg* _attributeDlg;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ public:
|
||||||
~MonitorToolBox();
|
~MonitorToolBox();
|
||||||
void addWidget(const QString &title, QWidget *widget);
|
void addWidget(const QString &title, QWidget *widget);
|
||||||
void removeWidget(const QString &title);
|
void removeWidget(const QString &title);
|
||||||
|
void removeAllWidget();
|
||||||
private:
|
private:
|
||||||
QWidget* _container;
|
QWidget* _container;
|
||||||
QVBoxLayout *m_pContentVBoxLayout;
|
QVBoxLayout *m_pContentVBoxLayout;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ BaseDrawingPanel::BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent,DiagramM
|
||||||
_pModel->setScene(m_pGraphicsScene);
|
_pModel->setScene(m_pGraphicsScene);
|
||||||
|
|
||||||
m_pStatusBar = new StatusBar(this);
|
m_pStatusBar = new StatusBar(this);
|
||||||
|
m_pStatusBar->setMaximumHeight(25);
|
||||||
connect(m_pGraphicsView,&DesignerView::onScaleChanged,m_pStatusBar,&StatusBar::onScaleLevelChanged);
|
connect(m_pGraphicsView,&DesignerView::onScaleChanged,m_pStatusBar,&StatusBar::onScaleLevelChanged);
|
||||||
|
|
||||||
_horizontalLayout = new QHBoxLayout();
|
_horizontalLayout = new QHBoxLayout();
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,6 @@ void DesignerScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
if(m_pDrawingPanel)
|
if(m_pDrawingPanel)
|
||||||
{
|
{
|
||||||
DiagramMode mode = m_pDrawingPanel->getMode();
|
DiagramMode mode = m_pDrawingPanel->getMode();
|
||||||
if(mode == DM_run)
|
|
||||||
return;
|
|
||||||
m_pDrawingPanel->selectorManager()->getWorkingSelector()->contextMenuEvent(event, this,mode);
|
m_pDrawingPanel->selectorManager()->getWorkingSelector()->contextMenuEvent(event, this,mode);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2710,8 +2710,8 @@ void FixedPortsModel::generateMonitorConfig(MonitorPanel* pPanel)
|
||||||
for(auto it = mapMeasure.begin(); it != mapMeasure.end();++it){
|
for(auto it = mapMeasure.begin(); it != mapMeasure.end();++it){
|
||||||
monitorItemAttributeInfo info;
|
monitorItemAttributeInfo info;
|
||||||
info.sGroup = iter.key();
|
info.sGroup = iter.key();
|
||||||
info.sTag = it->tag;
|
info.sTag = it->name;
|
||||||
info.sName = it->name;
|
info.sName = it->tag;
|
||||||
info.nConnectType = 1;
|
info.nConnectType = 1;
|
||||||
lstInfo.append(info);
|
lstInfo.append(info);
|
||||||
}
|
}
|
||||||
|
|
@ -2726,3 +2726,19 @@ void FixedPortsModel::generateMonitorConfig(MonitorPanel* pPanel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixedPortsModel::monitorItemSelected(QUuid uid)
|
||||||
|
{
|
||||||
|
auto pMonitor = dynamic_cast<MonitorPanel*>(_widget);
|
||||||
|
if(pMonitor){
|
||||||
|
pMonitor->itemSelected(uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedPortsModel::monitorItemDetailAttr(QUuid uid)
|
||||||
|
{
|
||||||
|
auto pMonitor = dynamic_cast<MonitorPanel*>(_widget);
|
||||||
|
if(pMonitor){
|
||||||
|
pMonitor->detailItemSelected(uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,18 @@
|
||||||
#include "monitorAttributeDlg.h"
|
#include "monitorAttributeDlg.h"
|
||||||
|
#include "monitorAttributeGroupDlg.h"
|
||||||
|
#include "monitorPanel.h"
|
||||||
#include "monitorToolBox.h"
|
#include "monitorToolBox.h"
|
||||||
|
#include "monitorSideBarDlg.h"
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
MonitorAttributeDlg::MonitorAttributeDlg(QWidget* parent)
|
MonitorAttributeDlg::MonitorAttributeDlg(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
,_pLayout(nullptr)
|
,_pLayout(nullptr)
|
||||||
|
,_pBox(nullptr)
|
||||||
|
,_pParent(nullptr)
|
||||||
{
|
{
|
||||||
|
_pParent = dynamic_cast<MonitorSideBarDlg*>(parent);
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17,26 +24,33 @@ MonitorAttributeDlg::~MonitorAttributeDlg()
|
||||||
void MonitorAttributeDlg::initial()
|
void MonitorAttributeDlg::initial()
|
||||||
{
|
{
|
||||||
_pLayout = new QVBoxLayout(this);
|
_pLayout = new QVBoxLayout(this);
|
||||||
|
_pBox = new MonitorToolBox(this);
|
||||||
|
_pBox->setContentsMargins(0, 0, 0, 0);
|
||||||
|
_pLayout->addWidget(_pBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorAttributeDlg::setCurAttribute(MonitorToolBox* pBox)
|
void MonitorAttributeDlg::generateAttributeGroups(QUuid uid)
|
||||||
{
|
{
|
||||||
if(_pLayout->count() == 0){ //当前无对象,添加
|
QMap<QString,QList<monitorItemAttributeInfo>> mapLst;
|
||||||
_pLayout->addWidget(pBox);
|
auto mapPara = getParent()->getParent()->getModelController()->getMonitorPara();
|
||||||
|
if(mapPara.contains(uid)){
|
||||||
|
auto lst = mapPara[uid];
|
||||||
|
for(auto &info:lst){
|
||||||
|
if(info.bSelected)
|
||||||
|
mapLst[info.sGroup].append(info);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
clearCurAttribute();
|
for(auto iter = mapLst.begin(); iter != mapLst.end();++iter){
|
||||||
_pLayout->addWidget(pBox);
|
MonitorAttributeGroupDlg* pDlg = new MonitorAttributeGroupDlg();
|
||||||
|
pDlg->setParent(this);
|
||||||
|
pDlg->createGroupView(iter.value());
|
||||||
|
_pBox->addWidget(iter.key(),pDlg);
|
||||||
|
}
|
||||||
|
_curId = uid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorAttributeDlg::clearCurAttribute() //移除当前属性
|
void MonitorAttributeDlg::clearAllGroup()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _pLayout->count(); ++i) {
|
_pBox->removeAllWidget();
|
||||||
QLayoutItem* item = _pLayout->itemAt(i);
|
|
||||||
auto pWidget = item->widget();
|
|
||||||
if(pWidget){
|
|
||||||
_pLayout->removeWidget(pWidget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,25 @@
|
||||||
#include "monitorAttributeGroupDlg.h"
|
#include "monitorAttributeGroupDlg.h"
|
||||||
|
#include "monitorAttributeDlg.h"
|
||||||
|
#include "monitorSideBarDlg.h"
|
||||||
|
#include "monitorPanel.h"
|
||||||
|
#include "monitorDetailAttributeDlg.h"
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QUuid>
|
||||||
|
#include <QChartView>
|
||||||
|
#include <QBarSeries>
|
||||||
|
#include <QBarCategoryAxis>
|
||||||
|
#include <QValueAxis>
|
||||||
|
#include <QLineSeries>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
MonitorAttributeGroupDlg::MonitorAttributeGroupDlg(QWidget* parent)
|
MonitorAttributeGroupDlg::MonitorAttributeGroupDlg(QWidget* parent)
|
||||||
: QScrollArea(parent)
|
: QScrollArea(parent)
|
||||||
,_layout(nullptr)
|
,_layout(nullptr)
|
||||||
|
,_pParent(nullptr)
|
||||||
|
,_pDetailParent(nullptr)
|
||||||
|
,_curMode(0)
|
||||||
{
|
{
|
||||||
initial();
|
initial();
|
||||||
}
|
}
|
||||||
|
|
@ -20,23 +34,230 @@ void MonitorAttributeGroupDlg::initial()
|
||||||
_layout = new QVBoxLayout(this);
|
_layout = new QVBoxLayout(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorAttributeGroupDlg::createGroupView()
|
void MonitorAttributeGroupDlg::createGroupView(QList<monitorItemAttributeInfo> lst)
|
||||||
{
|
{
|
||||||
QWidget* content = new QWidget();
|
QWidget* content = new QWidget();
|
||||||
QFormLayout* layout = new QFormLayout(content);
|
QGridLayout* gridLayout = new QGridLayout(content);
|
||||||
layout->setHorizontalSpacing(20); // 标签与控件间距
|
gridLayout->setHorizontalSpacing(20);
|
||||||
layout->setVerticalSpacing(12); // 行间距
|
gridLayout->setVerticalSpacing(12);
|
||||||
layout->setLabelAlignment(Qt::AlignRight); // 标签右对齐
|
//gridLayout->setContentsMargins(12, 12, 12, 12);
|
||||||
layout->setContentsMargins(12, 12, 12, 12); // 内边距
|
|
||||||
|
// 设置列的最小宽度和拉伸比例
|
||||||
|
gridLayout->setColumnMinimumWidth(0, 30); // 标签列最小宽度
|
||||||
|
gridLayout->setColumnStretch(0, 1); // 标签列拉伸因子
|
||||||
|
gridLayout->setColumnStretch(1, 5); // 控件列拉伸因子
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
for(auto& info : lst) {
|
||||||
|
QLabel* label = new QLabel(info.sTag, this);
|
||||||
|
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
label->setMaximumWidth(40); // 设置标签最大宽度
|
||||||
|
|
||||||
// 动态生成字段
|
|
||||||
/*for(auto& info:infos.info) {
|
|
||||||
QLabel* label = new QLabel(info.name,this);
|
|
||||||
QWidget* editor = createEditor(info);
|
QWidget* editor = createEditor(info);
|
||||||
formLayout->addRow(label, editor);
|
editor->setProperty("category", info.nShowType);
|
||||||
}*/
|
editor->setProperty("graphType", info.nGraphType);
|
||||||
|
editor->setProperty("connectPara", info.sConnectPara);
|
||||||
|
|
||||||
|
// 添加到网格布局
|
||||||
|
gridLayout->addWidget(label, row, 0, Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
gridLayout->addWidget(editor, row, 1);
|
||||||
|
|
||||||
|
// 设置行的拉伸因子(可选)
|
||||||
|
gridLayout->setRowStretch(row, 0); // 不拉伸,保持内容高度
|
||||||
|
|
||||||
|
_curWidget.insert(info.sTag, editor);
|
||||||
|
row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加一个拉伸行,使内容在顶部对齐
|
||||||
|
gridLayout->setRowStretch(row, 1);
|
||||||
|
|
||||||
setWidget(content);
|
setWidget(content);
|
||||||
setWidgetResizable(true);
|
setWidgetResizable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget* MonitorAttributeGroupDlg::createEditor(monitorItemAttributeInfo info)
|
||||||
|
{
|
||||||
|
QWidget* pWidget = nullptr;
|
||||||
|
if(info.nShowType == 0){ //正常显示
|
||||||
|
QLabel *label = new QLabel(this);
|
||||||
|
pWidget = label;
|
||||||
|
}
|
||||||
|
else{ //图表
|
||||||
|
QChartView* chartView = new QChartView(this);
|
||||||
|
chartView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
chartView->setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
|
QChart* chart = new QChart();
|
||||||
|
chartView->setChart(chart);
|
||||||
|
|
||||||
|
if (info.nGraphType == 0) {
|
||||||
|
// 创建折线序列
|
||||||
|
QLineSeries* series = new QLineSeries();
|
||||||
|
|
||||||
|
// 创建图表
|
||||||
|
chart->addSeries(series);
|
||||||
|
chart->setTitle(info.sName);
|
||||||
|
chart->setAnimationOptions(QChart::SeriesAnimations);
|
||||||
|
|
||||||
|
// 设置线条样式
|
||||||
|
QPen pen(Qt::blue);
|
||||||
|
pen.setWidth(3);
|
||||||
|
pen.setStyle(Qt::SolidLine);
|
||||||
|
series->setPen(pen);
|
||||||
|
|
||||||
|
// 创建坐标轴
|
||||||
|
QValueAxis* axisX = new QValueAxis();
|
||||||
|
QValueAxis* axisY = new QValueAxis();
|
||||||
|
|
||||||
|
// 设置坐标轴标题
|
||||||
|
axisX->setTitleText("时间");
|
||||||
|
axisY->setTitleText("值");
|
||||||
|
|
||||||
|
// 添加坐标轴到图表
|
||||||
|
chart->addAxis(axisX, Qt::AlignBottom);
|
||||||
|
chart->addAxis(axisY, Qt::AlignLeft);
|
||||||
|
|
||||||
|
// 将序列关联到坐标轴
|
||||||
|
series->attachAxis(axisX);
|
||||||
|
series->attachAxis(axisY);
|
||||||
|
|
||||||
|
// 设置默认范围或等待数据更新
|
||||||
|
axisX->setRange(0, 10); // 临时范围
|
||||||
|
axisY->setRange(0, 100);
|
||||||
|
|
||||||
|
chart->setTheme(QChart::ChartThemeLight);
|
||||||
|
chart->legend()->setVisible(true);
|
||||||
|
chart->legend()->setAlignment(Qt::AlignBottom);
|
||||||
|
}
|
||||||
|
else if (info.nGraphType == 1) {
|
||||||
|
QBarSeries* series = new QBarSeries();
|
||||||
|
chart->addSeries(series);
|
||||||
|
chart->setTitle(info.sName);
|
||||||
|
chart->setAnimationOptions(QChart::SeriesAnimations);
|
||||||
|
|
||||||
|
// 创建坐标轴
|
||||||
|
QBarCategoryAxis* axisX = new QBarCategoryAxis();
|
||||||
|
QValueAxis* axisY = new QValueAxis();
|
||||||
|
|
||||||
|
chart->addAxis(axisX, Qt::AlignBottom);
|
||||||
|
chart->addAxis(axisY, Qt::AlignLeft);
|
||||||
|
series->attachAxis(axisX);
|
||||||
|
series->attachAxis(axisY);
|
||||||
|
}
|
||||||
|
|
||||||
|
pWidget = chartView;
|
||||||
|
}
|
||||||
|
return pWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorAttributeGroupDlg::updateLineChartData(QChartView* chartView, const QVector<QPointF>& data)
|
||||||
|
{
|
||||||
|
if (!chartView || !chartView->chart()) return;
|
||||||
|
|
||||||
|
QChart* chart = chartView->chart();
|
||||||
|
if (chart->series().isEmpty()) return;
|
||||||
|
|
||||||
|
QLineSeries* series = qobject_cast<QLineSeries*>(chart->series().first());
|
||||||
|
if (!series) return;
|
||||||
|
|
||||||
|
// 清空旧数据,添加新数据
|
||||||
|
series->clear();
|
||||||
|
series->append(data);
|
||||||
|
|
||||||
|
// 更新坐标轴范围
|
||||||
|
if (!data.isEmpty()) {
|
||||||
|
QValueAxis* aX = nullptr;
|
||||||
|
QValueAxis* aY = nullptr;
|
||||||
|
|
||||||
|
// 方法1:通过方向获取
|
||||||
|
QList<QAbstractAxis*> xAxes = chart->axes(Qt::Horizontal);
|
||||||
|
QList<QAbstractAxis*> yAxes = chart->axes(Qt::Vertical);
|
||||||
|
|
||||||
|
for (QAbstractAxis* axis : xAxes) {
|
||||||
|
if (qobject_cast<QValueAxis*>(axis)) {
|
||||||
|
aX = static_cast<QValueAxis*>(axis);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (QAbstractAxis* axis : yAxes) {
|
||||||
|
if (qobject_cast<QValueAxis*>(axis)) {
|
||||||
|
aY = static_cast<QValueAxis*>(axis);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aX && aY) {
|
||||||
|
double minX = data.first().x();
|
||||||
|
double maxX = data.last().x();
|
||||||
|
double minY = std::numeric_limits<double>::max();
|
||||||
|
double maxY = std::numeric_limits<double>::lowest();
|
||||||
|
|
||||||
|
for (const QPointF& point : data) {
|
||||||
|
minY = qMin(minY, point.y());
|
||||||
|
maxY = qMax(maxY, point.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
double margin = (maxY - minY) * 0.1;
|
||||||
|
aX->setRange(minX, maxX);
|
||||||
|
aY->setRange(minY - margin, maxY + margin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorAttributeGroupDlg::updateData()
|
||||||
|
{
|
||||||
|
if(_pParent){
|
||||||
|
auto pModel = getModelController();
|
||||||
|
auto pMap = pModel->getMonitorPara();
|
||||||
|
QUuid uid = getCurUid();
|
||||||
|
|
||||||
|
if(pMap.contains(uid)){
|
||||||
|
auto info = pMap.value(uid);
|
||||||
|
|
||||||
|
for(auto &widget:_curWidget){
|
||||||
|
int nCate = widget->property("category").toInt();
|
||||||
|
int nGraph = widget->property("graphType").toInt();
|
||||||
|
QString sPara = widget->property("connectPara").toString();
|
||||||
|
|
||||||
|
for(auto& data:info){
|
||||||
|
if(data.sConnectPara == sPara){
|
||||||
|
if(nCate == 0){
|
||||||
|
QLabel* pLabel = dynamic_cast<QLabel*>(widget);
|
||||||
|
pLabel->setText(data.sValue);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(nGraph == 0){ //
|
||||||
|
QChartView* pView = dynamic_cast<QChartView*>(widget);
|
||||||
|
//updateLineChartData(pView,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FixedPortsModel* MonitorAttributeGroupDlg::getModelController()
|
||||||
|
{
|
||||||
|
FixedPortsModel* pModel;
|
||||||
|
if(_curMode == 0){
|
||||||
|
pModel = _pParent->getParent()->getParent()->getModelController();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pModel = _pDetailParent->getParent()->getModelController();
|
||||||
|
}
|
||||||
|
return pModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
QUuid MonitorAttributeGroupDlg::getCurUid()
|
||||||
|
{
|
||||||
|
if(_curMode == 0){
|
||||||
|
return _pParent->getCurId();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return _pDetailParent->getCurId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
#include "monitorDetailAttributeDlg.h"
|
||||||
|
#include "ui_monitorDetailAttributeDlg.h"
|
||||||
|
#include "monitorAttributeGroupDlg.h"
|
||||||
|
#include "monitorPanel.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
MonitorDetailAttributeDlg::MonitorDetailAttributeDlg(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
, ui(new Ui::monitorDetailAttributeDlg)
|
||||||
|
,_pParent(nullptr)
|
||||||
|
,m_gridLayout(nullptr)
|
||||||
|
{
|
||||||
|
_pParent = dynamic_cast<MonitorPanel*>(parent);
|
||||||
|
ui->setupUi(this);
|
||||||
|
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||||
|
initial();
|
||||||
|
}
|
||||||
|
|
||||||
|
MonitorDetailAttributeDlg::~MonitorDetailAttributeDlg()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorDetailAttributeDlg::initial()
|
||||||
|
{
|
||||||
|
_curColNum = 2;
|
||||||
|
connect(ui->btn_exit,&QPushButton::clicked,this,&MonitorDetailAttributeDlg::onCloseClicked);
|
||||||
|
connect(ui->cb_colNum,&QComboBox::currentTextChanged,this,&MonitorDetailAttributeDlg::onColChanged);
|
||||||
|
m_gridLayout = new QGridLayout(ui->content);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorDetailAttributeDlg::onCloseClicked()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorDetailAttributeDlg::onColChanged(const QString& str)
|
||||||
|
{
|
||||||
|
updateLayout(str.toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorDetailAttributeDlg::generateAttributeGroups(QUuid uid)
|
||||||
|
{
|
||||||
|
clearAllGroup();
|
||||||
|
QMap<QString,QList<monitorItemAttributeInfo>> mapLst;
|
||||||
|
auto mapPara = _pParent->getModelController()->getMonitorPara();
|
||||||
|
if(mapPara.contains(uid)){
|
||||||
|
_curId = uid;
|
||||||
|
auto lst = mapPara[uid];
|
||||||
|
for(auto &info:lst){
|
||||||
|
if(info.bSelected)
|
||||||
|
mapLst[info.sGroup].append(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto iter = mapLst.begin(); iter != mapLst.end();++iter){
|
||||||
|
MonitorAttributeGroupDlg* pDlg = new MonitorAttributeGroupDlg();
|
||||||
|
pDlg->setDetailParent(this);
|
||||||
|
pDlg->setCurMode(1);
|
||||||
|
pDlg->createGroupView(iter.value());
|
||||||
|
_curGroups.insert(iter.key(),pDlg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateLayout(_curColNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorDetailAttributeDlg::updateLayout(int columns)
|
||||||
|
{
|
||||||
|
_curColNum = columns;
|
||||||
|
int i = 0;
|
||||||
|
for(auto& pDlg:_curGroups){
|
||||||
|
int row = i / _curColNum;
|
||||||
|
int col = i % _curColNum;
|
||||||
|
m_gridLayout->addWidget(pDlg, row, col);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorDetailAttributeDlg::clearAllGroup()
|
||||||
|
{
|
||||||
|
for(auto& dlg:_curGroups){
|
||||||
|
m_gridLayout->removeWidget(dlg);
|
||||||
|
delete dlg;
|
||||||
|
}
|
||||||
|
_curGroups.clear();
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
#include "monitorSideBarDlg.h"
|
#include "monitorSideBarDlg.h"
|
||||||
#include "monitorSelectedItemsDlg.h"
|
#include "monitorSelectedItemsDlg.h"
|
||||||
#include "monitorConfigDlg.h"
|
#include "monitorConfigDlg.h"
|
||||||
|
#include "monitorAttributeDlg.h"
|
||||||
|
#include "monitorDetailAttributeDlg.h"
|
||||||
|
|
||||||
MonitorPanel::MonitorPanel(PowerEntity* pEntity,QWidget *parent,DiagramMode mode)
|
MonitorPanel::MonitorPanel(PowerEntity* pEntity,QWidget *parent,DiagramMode mode)
|
||||||
: BaseDrawingPanel(pEntity,parent,mode)
|
: BaseDrawingPanel(pEntity,parent,mode)
|
||||||
|
|
@ -20,6 +22,8 @@ MonitorPanel::MonitorPanel(PowerEntity* pEntity,QWidget *parent,DiagramMode mode
|
||||||
,_sideBar(nullptr)
|
,_sideBar(nullptr)
|
||||||
,_pConfigDlg(nullptr)
|
,_pConfigDlg(nullptr)
|
||||||
,_itemListmodel(nullptr)
|
,_itemListmodel(nullptr)
|
||||||
|
,_menuSetting(nullptr)
|
||||||
|
,_detailAttributeDlg(nullptr)
|
||||||
{
|
{
|
||||||
m_pStatusBar->setButtonVisible(false);
|
m_pStatusBar->setButtonVisible(false);
|
||||||
initial();
|
initial();
|
||||||
|
|
@ -39,6 +43,7 @@ void MonitorPanel::initial()
|
||||||
_hSplitter->addWidget(_sideBar);
|
_hSplitter->addWidget(_sideBar);
|
||||||
_sideBar->show();
|
_sideBar->show();
|
||||||
_pConfigDlg = new MonitorConfigDlg(this);
|
_pConfigDlg = new MonitorConfigDlg(this);
|
||||||
|
_detailAttributeDlg = new MonitorDetailAttributeDlg(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorPanel::closeEvent(QCloseEvent *closeEvent)
|
void MonitorPanel::closeEvent(QCloseEvent *closeEvent)
|
||||||
|
|
@ -67,6 +72,33 @@ void MonitorPanel::createToolBar()
|
||||||
connect(connectAction, &QAction::triggered, this, &MonitorPanel::onConncecClicked);
|
connect(connectAction, &QAction::triggered, this, &MonitorPanel::onConncecClicked);
|
||||||
_toolBar->addAction(connectAction);
|
_toolBar->addAction(connectAction);
|
||||||
|
|
||||||
|
QAction *otherAction = new QAction("其他设置", this);
|
||||||
|
_menuSetting = new QMenu(this);
|
||||||
|
QAction *toggleAction = _menuSetting->addAction("显示属性");
|
||||||
|
toggleAction->setCheckable(true);
|
||||||
|
|
||||||
|
// 连接菜单项点击事件
|
||||||
|
connect(toggleAction, &QAction::triggered, this, [this]() {
|
||||||
|
_sideBar->setVisible(!_sideBar->isVisible());
|
||||||
|
});
|
||||||
|
|
||||||
|
// 在显示菜单前同步菜单项状态
|
||||||
|
connect(_menuSetting, &QMenu::aboutToShow, this, [this, toggleAction]() {
|
||||||
|
toggleAction->setChecked(_sideBar->isVisible());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(otherAction, &QAction::triggered, this, [&]() {
|
||||||
|
QWidget *widget = _toolBar->widgetForAction(otherAction);
|
||||||
|
if (widget) {
|
||||||
|
QPoint pos = widget->mapToGlobal(QPoint(0, widget->height()));
|
||||||
|
_menuSetting->exec(pos);
|
||||||
|
} else {
|
||||||
|
_menuSetting->exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
_toolBar->addAction(otherAction);
|
||||||
|
|
||||||
// 设置工具栏样式
|
// 设置工具栏样式
|
||||||
_toolBar->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
_toolBar->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
||||||
_verticalLayout->setMenuBar(_toolBar);
|
_verticalLayout->setMenuBar(_toolBar);
|
||||||
|
|
@ -203,6 +235,18 @@ void MonitorPanel::initMonitorConfig()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MonitorPanel::itemSelected(QUuid uid)
|
||||||
|
{
|
||||||
|
_sideBar->getAttributeDlg()->clearAllGroup();
|
||||||
|
_sideBar->getAttributeDlg()->generateAttributeGroups(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonitorPanel::detailItemSelected(QUuid uid)
|
||||||
|
{
|
||||||
|
_detailAttributeDlg->show();
|
||||||
|
_detailAttributeDlg->generateAttributeGroups(uid);
|
||||||
|
}
|
||||||
|
|
||||||
void MonitorPanel::onRunClicked()
|
void MonitorPanel::onRunClicked()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ MonitorSelectedItemsDlg::MonitorSelectedItemsDlg(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
,_treeView(nullptr)
|
,_treeView(nullptr)
|
||||||
,_parent(nullptr)
|
,_parent(nullptr)
|
||||||
|
,_pLayout(nullptr)
|
||||||
{
|
{
|
||||||
_parent = dynamic_cast<MonitorSideBarDlg*>(parent);
|
_parent = dynamic_cast<MonitorSideBarDlg*>(parent);
|
||||||
initial();
|
initial();
|
||||||
|
|
@ -22,9 +23,22 @@ void MonitorSelectedItemsDlg::initial()
|
||||||
_treeView = new QTreeView(this);
|
_treeView = new QTreeView(this);
|
||||||
_treeView->setModel(_parent->getParent()->getLstModel());
|
_treeView->setModel(_parent->getParent()->getLstModel());
|
||||||
_treeView->setHeaderHidden(true);
|
_treeView->setHeaderHidden(true);
|
||||||
|
|
||||||
|
_pLayout = new QVBoxLayout(this);
|
||||||
|
_pLayout->addWidget(_treeView);
|
||||||
|
connect(_treeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
|
this, &MonitorSelectedItemsDlg::onSelectionChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorSelectedItemsDlg::updateItems()
|
void MonitorSelectedItemsDlg::updateItems()
|
||||||
{
|
{
|
||||||
_treeView->expandAll();
|
_treeView->expandAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MonitorSelectedItemsDlg::onSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||||
|
{
|
||||||
|
if(current.isValid()){
|
||||||
|
QUuid uid = current.data(Qt::UserRole+3).toUuid();
|
||||||
|
_parent->getParent()->getModelController()->monitorItemSelected(uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ MonitorSideBarDlg::MonitorSideBarDlg(QWidget* parent)
|
||||||
_parent = dynamic_cast<MonitorPanel*>(parent);
|
_parent = dynamic_cast<MonitorPanel*>(parent);
|
||||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||||
initial();
|
initial();
|
||||||
setMinimumWidth(100);
|
setMinimumWidth(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
MonitorSideBarDlg::~MonitorSideBarDlg()
|
MonitorSideBarDlg::~MonitorSideBarDlg()
|
||||||
|
|
@ -33,10 +33,12 @@ void MonitorSideBarDlg::initial()
|
||||||
|
|
||||||
// 创建垂直分割器
|
// 创建垂直分割器
|
||||||
QSplitter *splitter = new QSplitter(Qt::Vertical);
|
QSplitter *splitter = new QSplitter(Qt::Vertical);
|
||||||
splitter->setHandleWidth(2); // 设置分割条宽度
|
splitter->setHandleWidth(1); // 设置分割条宽度
|
||||||
|
|
||||||
splitter->addWidget(_itemsDlg);
|
splitter->addWidget(_itemsDlg);
|
||||||
splitter->addWidget(_attributeDlg);
|
splitter->addWidget(_attributeDlg);
|
||||||
|
|
||||||
|
splitter->setStretchFactor(0, 1); // 第一个部件的拉伸因子为1
|
||||||
|
splitter->setStretchFactor(1, 2); // 第二个部件的拉伸因子为3
|
||||||
sideLayout->addWidget(splitter);
|
sideLayout->addWidget(splitter);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ void MonitorToolBox::addWidget(const QString &title, QWidget *pWidget)
|
||||||
page->addWidget(title, pWidget);
|
page->addWidget(title, pWidget);
|
||||||
|
|
||||||
m_pContentVBoxLayout->addWidget(page);
|
m_pContentVBoxLayout->addWidget(page);
|
||||||
//pLayout->insertWidget(0,page);
|
|
||||||
//pLayout->addStretch(0);
|
|
||||||
m_mapWidget.insert(title,page);
|
m_mapWidget.insert(title,page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,3 +53,21 @@ void MonitorToolBox::removeWidget(const QString &title)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MonitorToolBox::removeAllWidget()
|
||||||
|
{
|
||||||
|
for(auto& pWidget:m_mapWidget){
|
||||||
|
if(pWidget)
|
||||||
|
{
|
||||||
|
MonitorToolPage* toolPage = dynamic_cast<MonitorToolPage*>(pWidget);
|
||||||
|
if(toolPage)
|
||||||
|
{
|
||||||
|
m_pContentVBoxLayout->removeWidget(toolPage);
|
||||||
|
delete toolPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mapWidget.clear();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,10 @@ void BaseSelector::mousePressEvent(QGraphicsSceneMouseEvent* event, DesignerScen
|
||||||
setCursor(scene, Qt::ClosedHandCursor);
|
setCursor(scene, Qt::ClosedHandCursor);
|
||||||
emit setWorkingSelector(ST_moving);
|
emit setWorkingSelector(ST_moving);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto pPro = item->getProperty();
|
||||||
|
if(pPro)
|
||||||
|
_model->monitorItemSelected(pPro->uuid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (items.count() > 1) //选中多个
|
else if (items.count() > 1) //选中多个
|
||||||
|
|
@ -655,7 +659,32 @@ void BaseSelector::dropEvent(QGraphicsSceneDragDropEvent *event, DesignerScene*,
|
||||||
|
|
||||||
void BaseSelector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event,DesignerScene* scene,DiagramMode sceneMode)
|
void BaseSelector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event,DesignerScene* scene,DiagramMode sceneMode)
|
||||||
{
|
{
|
||||||
|
if(sceneMode == DM_run){
|
||||||
QList<QGraphicsItem*> listItem = scene->selectedItems();
|
QList<QGraphicsItem*> listItem = scene->selectedItems();
|
||||||
|
if(listItem.isEmpty())
|
||||||
|
return;
|
||||||
|
QMenu menu;
|
||||||
|
QAction *detailAttrAction = menu.addAction(QString::fromWCharArray(L"详细属性"));
|
||||||
|
//connect(removeAction,&QAction::triggered,this,&DesignerScene::onDeleteClicked);
|
||||||
|
connect(detailAttrAction,&QAction::triggered,this,[&,scene](){
|
||||||
|
QList<QGraphicsItem*> listItem = scene->selectedItems();
|
||||||
|
if(listItem.isEmpty())
|
||||||
|
return;
|
||||||
|
else if(listItem.count() == 1)
|
||||||
|
{
|
||||||
|
GraphicsProjectModelItem* item = qgraphicsitem_cast<GraphicsProjectModelItem*>(listItem.first());
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
auto pPro = item->getProperty();
|
||||||
|
if(pPro){
|
||||||
|
_model->monitorItemDetailAttr(pPro->uuid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
/*QList<QGraphicsItem*> listItem = scene->selectedItems();
|
||||||
if(listItem.isEmpty())
|
if(listItem.isEmpty())
|
||||||
return;
|
return;
|
||||||
else if(listItem.count() == 1)
|
else if(listItem.count() == 1)
|
||||||
|
|
@ -682,7 +711,7 @@ void BaseSelector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event,Design
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.exec(QCursor::pos());
|
menu.exec(QCursor::pos());
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseSelector::setCursor(DesignerScene *scene, const QCursor &cursor)
|
void BaseSelector::setCursor(DesignerScene *scene, const QCursor &cursor)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>monitorDetailAttributeDlg</class>
|
||||||
|
<widget class="QDialog" name="monitorDetailAttributeDlg">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>796</width>
|
||||||
|
<height>543</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>21</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(191, 191, 191);</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<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">color: rgb(0, 0, 0);
|
||||||
|
font: 12pt "Microsoft YaHei UI";</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>属性详细信息</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>709</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>调整列数:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cb_colNum">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>3</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>4</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>5</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>6</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</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>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_exit">
|
||||||
|
<property name="text">
|
||||||
|
<string>退出详情</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="content">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>794</width>
|
||||||
|
<height>497</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Loading…
Reference in New Issue