emsApplication/applications/emsConfigurer/devicepropertypage.h

109 lines
2.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef DEVICEPROPERTYPAGE_H
#define DEVICEPROPERTYPAGE_H
#pragma execution_character_set("utf-8")
#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <QIntValidator>
#include <QSpinBox>
#include <QCheckBox>
#include <QKeyEvent>
#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(); //超时处理函数
void handleDownCounter(); //倒计时
private:
QTimer *m_pTimer;
QTimer *m_pDownCounterTimer;
int m_nDownCounter;
private:
MyTableModel* m_myModel;
protected:
void Refresh();
void InitializeTableView(MyTableModel *model, QTableView *tableView);
// 重写resizeEvent当QTableView窗口大小变化时按比例调整列宽
void resizeEvent(QResizeEvent *event) override;
//处理分页数据
int PageDataProcess();
//更新页数显示
void updatePageLabel();
//更新翻页按钮状态
void updatePageButtonState();
//翻倒第i页
void pageTo(int page);
protected:
void keyPressEvent(QKeyEvent *event) override;
private slots:
void onButtonClicked();
void onTableViewDoubleClicked(const QModelIndex &index);
void onFirstButtonClicked();
void onLastButtonClicked();
void onForwardButtonClicked();
void onNextButtonClicked();
void onGotoButtonClicked();
void CheckRefresh(int state);
private:
unsigned int filterBaseType;
unsigned int mask_code;
QTableView* m_pTableView;
QPushButton* m_pButton;
QPushButton* m_pForwardButton;
QPushButton* m_pNextButton;
QPushButton* m_pFirstButton;
QPushButton* m_pLastButton;
QIntValidator* m_pValidator;
QLabel* m_pGotoPageNumberLabel;
QLineEdit* m_pGotoPageNumberLineEdit;
QPushButton* m_pGotoPageNumberButton;
QCheckBox *m_pRefreshCheckBox;
QSpinBox* m_pTimerIntervalSpinBox;
QLabel* m_pDownCounterLabel;
QLabel* m_pPagesLabel;
QVector<int> columnWidths; // 存储初始列宽
private:
TableData m_TotalTableData;
TableData m_currentPageData;
int m_totalPageCount; //总页数
int m_currentPage; //当前页
int m_totalRows; //数据总行数
};
#endif // DEVICEPROPERTYPAGE_H