emsApplication/applications/EmsShower/customdisplaypanel.h

107 lines
2.1 KiB
C
Raw Normal View History

2025-03-07 16:16:57 +08:00
#ifndef CUSTOMDISPLAYPANEL_H
#define CUSTOMDISPLAYPANEL_H
#include <QWidget>
#include <QHBoxLayout>
#include <QStringList>
#include <QLabel>
#include <QVector>
#include <QTableWidget>
#include "openjson.h"
/**
*
* KPI
*
*/
class CustomDisplayPanel : public QWidget
{
Q_OBJECT
public:
explicit CustomDisplayPanel(QWidget *parent = nullptr);
protected:
int m_label_count;
int m_table_rows_count;
int m_table_rols_count;
QStringList m_lables;
QStringList m_rowItems;
QString m_imagePath;
QString m_mainLabel;
QVector<QLabel*> m_txtLabels;
QTableWidget* m_pTableWidget;
public:
typedef enum _tagPanelType: int
{
PANEL_TEMPERATURE = 1,
PANEL_BATTERY,
PANEL_POWER,
PANEL_AC,
PANEL_PV,
PANEL_ALARM,
PANEL_INVERTER,
PANEL_HOME,
} PanelType;
public:
void setImage(const QString& img)
{
m_imagePath = img;
}
//设置显示指标和表格数据其中显示的标签数量需要跟QStringlist的数量一致
void setLableCount(int number = 5)
{
m_label_count = number;
};
void setTableRolCount(int number = 2)
{
m_table_rols_count = number;
}
void setTableRowsCount(int number = 10)
{
m_table_rows_count = number;
};
void setLables(const QStringList& sl)
{
m_lables = sl;
}
void setRowItems(const QStringList& sl)
{
m_rowItems = sl;
}
//设置Panel的标题
void setMainLabel(QString label)
{
m_mainLabel = label;
}
virtual void Build();
public:
//更新数据
void UpdateData(OpenJson& json);
void UpdateTemperature(OpenJson& json);
void UpdateAlarm(OpenJson& json);
public:
signals:
};
class CustomWarningPanel : public CustomDisplayPanel
{
Q_OBJECT
public:
explicit CustomWarningPanel(QWidget *parent = nullptr);
virtual void Build();
};
#endif // CUSTOMDISPLAYPANEL_H