2024-09-12 16:23:44 +08:00
|
|
|
|
#ifndef DEVICEPROPERTYPAGE_H
|
|
|
|
|
#define DEVICEPROPERTYPAGE_H
|
|
|
|
|
|
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
2024-11-11 15:28:31 +08:00
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QIntValidator>
|
2024-11-13 17:05:57 +08:00
|
|
|
|
#include <QSpinBox>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QKeyEvent>
|
2024-11-11 15:28:31 +08:00
|
|
|
|
|
2024-09-12 16:23:44 +08:00
|
|
|
|
#include "datafetcher.h"
|
|
|
|
|
|
|
|
|
|
class MyTableModel;
|
|
|
|
|
class QTimer;
|
|
|
|
|
class QTableView;
|
|
|
|
|
class QPushButton;
|
|
|
|
|
|
|
|
|
|
class DevicePropertyPage : public QWidget,public DataFetcher
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit DevicePropertyPage(QWidget *parent = nullptr);
|
|
|
|
|
~DevicePropertyPage();
|
|
|
|
|
void setBaseType(unsigned int base,unsigned int mask);
|
|
|
|
|
void InitializeTable();
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void handleTimeout(); //超时处理函数
|
2024-11-13 17:05:57 +08:00
|
|
|
|
void handleDownCounter(); //倒计时
|
2024-09-12 16:23:44 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QTimer *m_pTimer;
|
2024-11-13 17:05:57 +08:00
|
|
|
|
QTimer *m_pDownCounterTimer;
|
|
|
|
|
int m_nDownCounter;
|
2024-09-12 16:23:44 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
MyTableModel* m_myModel;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void Refresh();
|
2024-09-14 13:01:48 +08:00
|
|
|
|
void InitializeTableView(MyTableModel *model, QTableView *tableView);
|
2024-09-12 16:23:44 +08:00
|
|
|
|
|
2024-09-13 12:53:02 +08:00
|
|
|
|
// 重写resizeEvent,当QTableView窗口大小变化时按比例调整列宽
|
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
|
|
2024-11-11 15:28:31 +08:00
|
|
|
|
//处理分页数据
|
|
|
|
|
int PageDataProcess();
|
|
|
|
|
|
|
|
|
|
//更新页数显示
|
|
|
|
|
void updatePageLabel();
|
|
|
|
|
|
|
|
|
|
//更新翻页按钮状态
|
|
|
|
|
void updatePageButtonState();
|
|
|
|
|
|
|
|
|
|
//翻倒第i页
|
|
|
|
|
void pageTo(int page);
|
|
|
|
|
|
2024-11-13 17:05:57 +08:00
|
|
|
|
protected:
|
|
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
|
|
2024-09-12 16:23:44 +08:00
|
|
|
|
private slots:
|
|
|
|
|
void onButtonClicked();
|
|
|
|
|
|
|
|
|
|
void onTableViewDoubleClicked(const QModelIndex &index);
|
|
|
|
|
|
2024-11-11 15:28:31 +08:00
|
|
|
|
void onFirstButtonClicked();
|
|
|
|
|
void onLastButtonClicked();
|
|
|
|
|
void onForwardButtonClicked();
|
|
|
|
|
void onNextButtonClicked();
|
|
|
|
|
void onGotoButtonClicked();
|
2024-11-13 17:05:57 +08:00
|
|
|
|
void CheckRefresh(int state);
|
2024-09-12 16:23:44 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
unsigned int filterBaseType;
|
|
|
|
|
unsigned int mask_code;
|
|
|
|
|
QTableView* m_pTableView;
|
|
|
|
|
QPushButton* m_pButton;
|
2024-11-11 15:28:31 +08:00
|
|
|
|
|
|
|
|
|
QPushButton* m_pForwardButton;
|
|
|
|
|
QPushButton* m_pNextButton;
|
|
|
|
|
QPushButton* m_pFirstButton;
|
|
|
|
|
QPushButton* m_pLastButton;
|
|
|
|
|
|
|
|
|
|
QIntValidator* m_pValidator;
|
|
|
|
|
QLabel* m_pGotoPageNumberLabel;
|
|
|
|
|
QLineEdit* m_pGotoPageNumberLineEdit;
|
|
|
|
|
QPushButton* m_pGotoPageNumberButton;
|
|
|
|
|
|
2024-11-13 17:05:57 +08:00
|
|
|
|
QCheckBox *m_pRefreshCheckBox;
|
|
|
|
|
QSpinBox* m_pTimerIntervalSpinBox;
|
|
|
|
|
QLabel* m_pDownCounterLabel;
|
2024-11-11 15:28:31 +08:00
|
|
|
|
QLabel* m_pPagesLabel;
|
|
|
|
|
|
2024-09-13 12:53:02 +08:00
|
|
|
|
QVector<int> columnWidths; // 存储初始列宽
|
2024-11-11 15:28:31 +08:00
|
|
|
|
private:
|
|
|
|
|
TableData m_TotalTableData;
|
|
|
|
|
TableData m_currentPageData;
|
|
|
|
|
|
|
|
|
|
int m_totalPageCount; //总页数
|
|
|
|
|
int m_currentPage; //当前页
|
|
|
|
|
int m_totalRows; //数据总行数
|
2024-09-12 16:23:44 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // DEVICEPROPERTYPAGE_H
|