|
11 | 11 | // t: type, x: property name
|
12 | 12 | #define PropertyPrivateSet(t, x) private: t _##x; \
|
13 | 13 | public: t x() const {return _##x;} \
|
14 |
| - private: void x(const t& v){_##x = v;} |
| 14 | + private: void x(const t& v){_##x = v; notify##x(v);} |
15 | 15 |
|
16 | 16 |
|
17 | 17 | // t: type, x: property name
|
18 | 18 | #define PropertyProtectedSet(t, x) private: t _##x; \
|
19 | 19 | public: t x() const {return _##x;} \
|
20 |
| - protected: void x(const t& v){_##x = v;} |
| 20 | + protected: void x(const t& v){_##x = v; notify##x(v);} |
21 | 21 |
|
22 | 22 | // t: type, x: property name
|
23 | 23 | #define PropertyPublicSet(t, x) private: t _##x; \
|
24 | 24 | public: t x() const {return _##x;} \
|
25 |
| - void x(const t& v){_##x = v;} |
| 25 | + void x(const t& v){_##x = v; notify##x(v);} |
26 | 26 |
|
27 | 27 |
|
28 | 28 | // t: type, x: property name
|
29 |
| -#define MetaPropertyPrivateSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 29 | +#define MetaPropertyPrivateSet_List(t, x) Q_SIGNALS: void notify##x(const QVariantList& i); \ |
| 30 | + private: Q_PROPERTY(QVariantList x READ x WRITE x NOTIFY notify##x) \ |
30 | 31 | PropertyPrivateSet(QVariantList, x) \
|
31 | 32 | void append##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
|
| 33 | + void insert##t(int ind, const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.insert(ind,v);}} \ |
32 | 34 | void remove##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
|
33 | 35 | public: \
|
34 | 36 | int count##x()const {return _##x.length();} \
|
|
37 | 39 |
|
38 | 40 |
|
39 | 41 | // t: type, x: property name
|
40 |
| -#define MetaPropertyProtectedSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 42 | +#define MetaPropertyProtectedSet_List(t, x) Q_SIGNALS: void notify##x(const QVariantList& i); \ |
| 43 | + private: Q_PROPERTY(QVariantList x READ x WRITE x NOTIFY notify##x) \ |
41 | 44 | PropertyProtectedSet(QVariantList, x) \
|
42 | 45 | void append##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
|
| 46 | + void insert##t(int ind, const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.insert(ind,v);}} \ |
43 | 47 | void remove##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
|
44 | 48 | public: \
|
45 | 49 | int count##x()const {return _##x.length();} \
|
|
48 | 52 |
|
49 | 53 |
|
50 | 54 | // t: type, x: property name
|
51 |
| -#define MetaPropertyPublicSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 55 | +#define MetaPropertyPublicSet_List(t, x) Q_SIGNALS: void notify##x(const QVariantList& i); \ |
| 56 | + private: Q_PROPERTY(QVariantList x READ x WRITE x NOTIFY notify##x) \ |
52 | 57 | PropertyPublicSet(QVariantList, x) \
|
53 | 58 | public: \
|
54 | 59 | void append##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
|
| 60 | + void insert##t(int ind, const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.insert(ind,v);}} \ |
55 | 61 | void remove##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
|
56 | 62 | int count##x()const {return _##x.length();} \
|
57 | 63 | t item##x##At(int i) {return _##x.at(i).value<t>();}
|
|
90 | 96 | public: void x(QObject* v){_##x = v;}
|
91 | 97 |
|
92 | 98 | // t: type, x: property name
|
93 |
| -#define MetaPropertyPrivateSet(t, x) private: Q_PROPERTY(t x READ x WRITE x) \ |
| 99 | +#define MetaPropertyPrivateSet(t, x) Q_SIGNALS: void notify##x(const t& i); \ |
| 100 | + private: Q_PROPERTY(t x READ x WRITE x NOTIFY notify##x) \ |
94 | 101 | PropertyPrivateSet(t, x)
|
95 | 102 |
|
96 | 103 |
|
97 | 104 | // t: type, x: property name
|
98 |
| -#define MetaPropertyProtectedSet(t, x) private: Q_PROPERTY(t x READ x WRITE x) \ |
| 105 | +#define MetaPropertyProtectedSet(t, x) Q_SIGNALS: void notify##x(const t& i); \ |
| 106 | + private: Q_PROPERTY(t x READ x WRITE x NOTIFY notify##x) \ |
99 | 107 | PropertyProtectedSet(t, x)
|
100 | 108 |
|
101 | 109 | // t: type, x: property name
|
102 |
| -#define MetaPropertyPublicSet(t, x) private: Q_PROPERTY(t x READ x WRITE x) \ |
| 110 | +#define MetaPropertyPublicSet(t, x) Q_SIGNALS: void notify##x(const t& i); \ |
| 111 | + private: Q_PROPERTY(t x READ x WRITE x NOTIFY notify##x) \ |
103 | 112 | PropertyPublicSet(t, x)
|
104 | 113 |
|
105 | 114 | // t: type, x: property name
|
106 |
| -#define MetaPropertyPrivateSet_Ptr(t, x) private: Q_PROPERTY(QObject* x READ x WRITE x) \ |
| 115 | +#define MetaPropertyPrivateSet_Ptr(t, x) Q_SIGNALS: void notify##x(QObject* i); \ |
| 116 | + private: Q_PROPERTY(QObject* x READ x WRITE x NOTIFY notify##x) \ |
107 | 117 | PropertyPrivateSet_Ptr_O(t, x) \
|
108 | 118 | public: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);}
|
109 | 119 |
|
110 | 120 |
|
111 | 121 | // t: type, x: property name
|
112 |
| -#define MetaPropertyProtectedSet_Ptr(t, x) private: Q_PROPERTY(QObject* x READ x WRITE x) \ |
| 122 | +#define MetaPropertyProtectedSet_Ptr(t, x) Q_SIGNALS: void notify##x(QObject* i); \ |
| 123 | + private: Q_PROPERTY(QObject* x READ x WRITE x) \ |
113 | 124 | PropertyProtectedSet_Ptr_O(t, x) \
|
114 | 125 | public: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);}
|
115 | 126 |
|
116 | 127 |
|
117 | 128 | // t: type, x: property name
|
118 |
| -#define MetaPropertyPublicSet_Ptr(t, x) private: Q_PROPERTY(QObject* x READ x WRITE x) \ |
| 129 | +#define MetaPropertyPublicSet_Ptr(t, x) Q_SIGNALS: void notify##x(QObject* i); \ |
| 130 | + private: Q_PROPERTY(QObject* x READ x WRITE x) \ |
119 | 131 | PropertyPublicSet_Ptr_O(t, x) \
|
120 | 132 | public: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);}
|
121 | 133 |
|
122 | 134 | // t: type, x: property name
|
123 |
| -#define MetaPropertyPrivateSet_Ptr_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 135 | +#define MetaPropertyPrivateSet_Ptr_List(t, x) Q_SIGNALS: void notify##x(const QVariantList& i); \ |
| 136 | + private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
124 | 137 | PropertyPrivateSet(QVariantList, x) \
|
125 | 138 | private: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);} \
|
126 | 139 | void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
|
| 140 | + void insert##t(int ind, t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.insert(ind,v);}} \ |
127 | 141 | void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
|
128 |
| - public: int count##t()const {return _##x.length();} \ |
129 |
| - t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
130 |
| - bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
| 142 | + t* remove##t##At(int ind){t* i = _##x.at(ind).value<t*>(); QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);} return i;} \ |
| 143 | + public: Q_INVOKABLE int count##t()const {return _##x.length();} \ |
| 144 | + Q_INVOKABLE t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
| 145 | + Q_INVOKABLE bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
131 | 146 |
|
132 | 147 |
|
133 | 148 | // t: type, x: property name
|
134 |
| -#define MetaPropertyProtectedSet_Ptr_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 149 | +#define MetaPropertyProtectedSet_Ptr_List(t, x) Q_SIGNALS: void notify##x(const QVariantList& i); \ |
| 150 | + private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
135 | 151 | PropertyProtectedSet(QVariantList, x) \
|
136 | 152 | protected: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);} \
|
137 | 153 | void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
|
| 154 | + void insert##t(int ind, t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.insert(ind,v);}} \ |
138 | 155 | void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
|
139 |
| - public: int count##t()const {return _##x.length();} \ |
140 |
| - t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
141 |
| - bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
| 156 | + t* remove##t##At(int ind){t* i = _##x.at(ind).value<t*>(); QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);} return i;} \ |
| 157 | + public: Q_INVOKABLE int count##t()const {return _##x.length();} \ |
| 158 | + Q_INVOKABLE t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
| 159 | + Q_INVOKABLE bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
142 | 160 |
|
143 | 161 |
|
144 | 162 | // t: type, x: property name
|
145 |
| -#define MetaPropertyPublicSet_Ptr_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 163 | +#define MetaPropertyPublicSet_Ptr_List(t, x) Q_SIGNALS: void notify##x(const QVariantList& i); \ |
| 164 | + private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
146 | 165 | PropertyPublicSet(QVariantList, x) \
|
147 | 166 | public: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);} \
|
148 |
| - void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \ |
149 |
| - void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \ |
150 |
| - int count##t()const {return _##x.length();} \ |
151 |
| - t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
152 |
| - bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
| 167 | + Q_INVOKABLE void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \ |
| 168 | + Q_INVOKABLE void insert##t(int ind, t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.insert(ind,v);}} \ |
| 169 | + Q_INVOKABLE void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \ |
| 170 | + Q_INVOKABLE t* remove##t##At(int ind){t* i = _##x.at(ind).value<t*>(); QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);} return i;} \ |
| 171 | + Q_INVOKABLE int count##t()const {return _##x.length();} \ |
| 172 | + Q_INVOKABLE t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
| 173 | + Q_INVOKABLE bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
153 | 174 |
|
154 | 175 |
|
155 | 176 | /**
|
|
0 commit comments