-
Notifications
You must be signed in to change notification settings - Fork 22
/
qmlsectionbuttons.h
46 lines (35 loc) · 1.05 KB
/
qmlsectionbuttons.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
41
42
43
44
45
46
#ifndef QMLSECTIONBUTTONS_H
#define QMLSECTIONBUTTONS_H
#include <QObject>
#include <QVariant>
#include <QVariantList>
#include "btnenum.h"
class QMLSectionButtons : public QObject
{
Q_OBJECT
protected:
QVariantList states;
bool needRead = true;
public:
QMLSectionButtons(QObject * parent = 0);
static inline QObject *aog_root = NULL;
static inline void set_aog_root(QObject *aog_root_) { aog_root = aog_root_;}
inline btnStates get (int sectionno) {
if (needRead) {
needRead = false;
states = aog_root->property("sectionButtonState").toList();
}
return (btnStates)states[sectionno].toInt();
}
inline void set (int sectionno, btnStates new_state) {
if (needRead) {
needRead = false;
states = aog_root->property("sectionButtonState").toList();
}
states[sectionno] = QVariant((int) new_state);
aog_root->setProperty("sectionButtonState", states);
}
public slots:
void onStatesUpdated();
};
#endif // QMLSECTIONBUTTONS_H