-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinterfacemodel.h
40 lines (30 loc) · 886 Bytes
/
interfacemodel.h
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
#pragma once
#include <QStandardItem>
#include <QStandardItemModel>
class InterfaceItem : public QStandardItem {
public:
enum Roles {
indexRole = Qt::UserRole + 6,
nameRole = Qt::UserRole + 7,
};
InterfaceItem(unsigned char index, QString name);
int type() const override;
};
class InterfaceModel : public QStandardItemModel {
Q_OBJECT
Q_PROPERTY(int currentIndex MEMBER mCurrentIndex NOTIFY currrentIndexChanged);
Q_PROPERTY(int currentInterface MEMBER mCurrentInterface NOTIFY
currentInterfaceChanged)
public:
InterfaceModel(QObject *parent = nullptr);
void append(unsigned char index, QString name);
void loadInterfaces();
signals:
void currrentIndexChanged();
void currentInterfaceChanged(int currentInterface);
private slots:
void updateCurrentInterfaceIndex();
private:
int mCurrentIndex;
int mCurrentInterface;
};