2025-11-21 19:22:41 +08:00
|
|
|
#include "monitorAttributeDlg.h"
|
2025-11-25 20:29:32 +08:00
|
|
|
#include "monitorAttributeGroupDlg.h"
|
|
|
|
|
#include "monitorPanel.h"
|
2025-11-21 19:22:41 +08:00
|
|
|
#include "monitorToolBox.h"
|
2025-11-25 20:29:32 +08:00
|
|
|
#include "monitorSideBarDlg.h"
|
2025-11-21 19:22:41 +08:00
|
|
|
#include <QVBoxLayout>
|
2025-11-26 20:33:13 +08:00
|
|
|
#include <QLabel>
|
2025-11-25 20:29:32 +08:00
|
|
|
#include "global.h"
|
2025-11-21 19:22:41 +08:00
|
|
|
|
|
|
|
|
MonitorAttributeDlg::MonitorAttributeDlg(QWidget* parent)
|
|
|
|
|
: QDialog(parent)
|
|
|
|
|
,_pLayout(nullptr)
|
2025-11-25 20:29:32 +08:00
|
|
|
,_pBox(nullptr)
|
|
|
|
|
,_pParent(nullptr)
|
2025-11-21 19:22:41 +08:00
|
|
|
{
|
2025-11-25 20:29:32 +08:00
|
|
|
_pParent = dynamic_cast<MonitorSideBarDlg*>(parent);
|
2025-11-21 19:22:41 +08:00
|
|
|
initial();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MonitorAttributeDlg::~MonitorAttributeDlg()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MonitorAttributeDlg::initial()
|
|
|
|
|
{
|
2025-11-26 20:33:13 +08:00
|
|
|
// 创建标题栏
|
|
|
|
|
QWidget *titleBar = new QWidget(this);
|
|
|
|
|
titleBar->setFixedHeight(21);
|
|
|
|
|
titleBar->setStyleSheet("background-color: #2b579a; color: white;");
|
|
|
|
|
|
|
|
|
|
// 标题栏布局
|
|
|
|
|
QHBoxLayout *titleLayout = new QHBoxLayout(titleBar);
|
|
|
|
|
titleLayout->setContentsMargins(10, 0, 5, 0);
|
|
|
|
|
|
|
|
|
|
// 标题标签
|
|
|
|
|
QLabel *titleLabel = new QLabel("对象属性");
|
|
|
|
|
titleLabel->setStyleSheet("color: white; font-weight: bold;");
|
|
|
|
|
|
|
|
|
|
titleLayout->addWidget(titleLabel);
|
|
|
|
|
|
2025-11-21 19:22:41 +08:00
|
|
|
_pLayout = new QVBoxLayout(this);
|
2025-11-25 20:29:32 +08:00
|
|
|
_pBox = new MonitorToolBox(this);
|
|
|
|
|
_pBox->setContentsMargins(0, 0, 0, 0);
|
2025-11-26 20:33:13 +08:00
|
|
|
_pLayout->addWidget(titleBar);
|
2025-11-25 20:29:32 +08:00
|
|
|
_pLayout->addWidget(_pBox);
|
2025-11-21 19:22:41 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-25 20:29:32 +08:00
|
|
|
void MonitorAttributeDlg::generateAttributeGroups(QUuid uid)
|
2025-11-21 19:22:41 +08:00
|
|
|
{
|
2025-11-25 20:29:32 +08:00
|
|
|
QMap<QString,QList<monitorItemAttributeInfo>> mapLst;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(auto iter = mapLst.begin(); iter != mapLst.end();++iter){
|
|
|
|
|
MonitorAttributeGroupDlg* pDlg = new MonitorAttributeGroupDlg();
|
|
|
|
|
pDlg->setParent(this);
|
|
|
|
|
pDlg->createGroupView(iter.value());
|
|
|
|
|
_pBox->addWidget(iter.key(),pDlg);
|
|
|
|
|
}
|
|
|
|
|
_curId = uid;
|
2025-11-21 19:22:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-25 20:29:32 +08:00
|
|
|
void MonitorAttributeDlg::clearAllGroup()
|
2025-11-21 19:22:41 +08:00
|
|
|
{
|
2025-11-25 20:29:32 +08:00
|
|
|
_pBox->removeAllWidget();
|
2025-11-21 19:22:41 +08:00
|
|
|
}
|