45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
#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
|