89 lines
2.3 KiB
C++
89 lines
2.3 KiB
C++
#ifndef MEASURERESULTLISTWIDGET_H
|
|
#define MEASURERESULTLISTWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QScrollArea>
|
|
#include <QMap>
|
|
#include <QLabel>
|
|
#include <QFrame>
|
|
#include "IVrWheelMeasureConfig.h"
|
|
|
|
/**
|
|
* @brief 单个设备结果卡片控件
|
|
*/
|
|
class DeviceResultCard : public QFrame
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DeviceResultCard(const QString& deviceName, QWidget* parent = nullptr);
|
|
~DeviceResultCard();
|
|
|
|
void updateResult(const WheelMeasureData& data, bool isValid);
|
|
void clearResult();
|
|
QString getDeviceName() const { return m_deviceName; }
|
|
|
|
private:
|
|
void setupUI();
|
|
|
|
QString m_deviceName;
|
|
QLabel* m_nameLabel = nullptr;
|
|
QLabel* m_heightLabel = nullptr;
|
|
QLabel* m_groundHeightLabel = nullptr; // 到地面高度
|
|
QLabel* m_archPosLabel = nullptr; // 拱点位置
|
|
QLabel* m_upPosLabel = nullptr; // 上点位置
|
|
QLabel* m_downPosLabel = nullptr; // 下点位置
|
|
QLabel* m_timestampLabel = nullptr;
|
|
QLabel* m_statusLabel = nullptr;
|
|
};
|
|
|
|
/**
|
|
* @brief 检测结果列表控件
|
|
* 每个设备显示为一个卡片,显示最新的检测结果
|
|
*/
|
|
class MeasureResultListWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MeasureResultListWidget(QWidget* parent = nullptr);
|
|
~MeasureResultListWidget();
|
|
|
|
/**
|
|
* @brief 设置设备列表
|
|
* @param deviceNames 设备名称列表
|
|
*/
|
|
void setDeviceList(const QStringList& deviceNames);
|
|
|
|
/**
|
|
* @brief 更新设备检测结果
|
|
* @param deviceName 设备名称
|
|
* @param data 检测数据
|
|
* @param isValid 结果是否有效
|
|
*/
|
|
void updateDeviceResult(const QString& deviceName, const WheelMeasureData& data, bool isValid);
|
|
|
|
/**
|
|
* @brief 清空所有结果
|
|
*/
|
|
void clearAllResults();
|
|
|
|
/**
|
|
* @brief 清空指定设备的结果
|
|
*/
|
|
void clearDeviceResult(const QString& deviceName);
|
|
|
|
private:
|
|
void setupUI();
|
|
DeviceResultCard* findOrCreateCard(const QString& deviceName);
|
|
|
|
QScrollArea* m_scrollArea = nullptr;
|
|
QWidget* m_contentWidget = nullptr;
|
|
QVBoxLayout* m_contentLayout = nullptr;
|
|
QMap<QString, DeviceResultCard*> m_deviceCards;
|
|
};
|
|
|
|
#endif // MEASURERESULTLISTWIDGET_H
|