2025-08-31 21:08:28 +08:00
|
|
|
|
#ifndef TEARINGDATATABLEWIDGET_H
|
|
|
|
|
|
#define TEARINGDATATABLEWIDGET_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
#include <QTableWidget>
|
2025-09-24 22:36:13 +08:00
|
|
|
|
#include <QTableWidgetItem>
|
2025-08-31 21:08:28 +08:00
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
|
#include <QJsonObject>
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
#include "IStatusUpdate.h"
|
|
|
|
|
|
|
2025-09-24 22:36:13 +08:00
|
|
|
|
// 自定义TableWidgetItem类,支持按数字值排序
|
|
|
|
|
|
class NumericTableWidgetItem : public QTableWidgetItem
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
NumericTableWidgetItem(const QString &text);
|
|
|
|
|
|
|
|
|
|
|
|
bool operator<(const QTableWidgetItem &other) const override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
double toDouble() const;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-31 21:08:28 +08:00
|
|
|
|
class TearingDataTableWidget : public QWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
explicit TearingDataTableWidget(QWidget *parent = nullptr);
|
|
|
|
|
|
~TearingDataTableWidget();
|
|
|
|
|
|
|
|
|
|
|
|
void addData(const TearingData &data);
|
|
|
|
|
|
void addData(const std::vector<TearingData> &dataList);
|
|
|
|
|
|
void addData(const QJsonObject &data);
|
|
|
|
|
|
void clearData();
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
void setupUI();
|
|
|
|
|
|
void setupTable();
|
2025-09-24 22:36:13 +08:00
|
|
|
|
QString getTearStatusText(const QString &status);
|
|
|
|
|
|
QString getTearTypeText(const QString &type);
|
|
|
|
|
|
int findExistingRowById(const QString &id);
|
|
|
|
|
|
|
|
|
|
|
|
// 排序相关的私有方法
|
|
|
|
|
|
void connectHeaderSignals();
|
2025-08-31 21:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
QTableWidget *m_tableWidget;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TEARINGDATATABLEWIDGET_H
|