-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtablemanager.h
More file actions
65 lines (53 loc) · 1.53 KB
/
tablemanager.h
File metadata and controls
65 lines (53 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef TABLEMANAGER_H
#define TABLEMANAGER_H
#include <QObject>
#include <QJsonObject>
#include <QTableWidget>
#include <QMap>
#include <QCheckBox>
class TableManager : public QObject {
Q_OBJECT
public:
explicit TableManager(QObject *parent = nullptr);
void readInitialize(QTabWidget* tabWidget_, QCheckBox *multyBox, QString registerPath);
void chooseAllRegInTab(int index);
void clearTable();
void updateTable();
struct Register
{
int Address;
int Value;
int Access;
int Digits;
float Multy;
bool isWrite;
bool isRead;
int dtype;
};
enum ConversionType {
ToUint16 = 0,
ToInt16 = 1
};
Q_ENUM(ConversionType)
QMap<int, Register> registers;
int numRegisterRead;
int startRegAddress;
QMap<int, QTableWidgetItem> registersTalbeItem;
QVector<int> regAddress;
private slots:
void onCellClicked(int row, int column);
void onEnterClicked(QTableWidget* table);
void onCellDoubleClicked(int row, int column);
private:
void readJsonData(const QString jsonDataPath);
void pasteJsonData();
QTableWidget* configTab(QString tab, QWidget* newTab, QJsonObject regObject);
int configTable(QJsonObject regInfo, QTableWidget* table, int row);
void configItem(QTableWidgetItem* item);
void toggleRegisterState(QTableWidget* table, int row);
QTableWidget *m_tableWidget;
QJsonObject jsonData;
QTabWidget *m_tabWidget;
QCheckBox *m_multyBox;
};
#endif // TABLEMANAGER_H