-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVObject.h
More file actions
38 lines (34 loc) · 779 Bytes
/
VObject.h
File metadata and controls
38 lines (34 loc) · 779 Bytes
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
#ifndef VOBJECT_H
#define VOBJECT_H
#include <QObject>
#include <QVariant>
class VObject : public QObject
{
Q_OBJECT
public:
VObject(QObject *parent=nullptr) :QObject(parent){}
VObject(const QVariant &value, QObject *parent=nullptr)
:QObject(parent), m_value(value){}
VObject& operator=(const VObject &obj){
setValue(obj.m_value);
return *this;
}
VObject& operator=(const QVariant &value){
setValue(value);
return *this;
}
void setValue(const QVariant &v){
if(v == m_value)
return;
m_value = v;
emit valueChanged();
}
QVariant value()const{
return m_value;
}
signals:
void valueChanged();
private:
QVariant m_value;
};
#endif // VOBJECT_H