|
18 | 18 | public: t x() const {return _##x;} \
|
19 | 19 | void x(const t& v){_##x = v;}
|
20 | 20 |
|
| 21 | +// t: type, x: property name |
| 22 | +#define MetaPropertyPrivateSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 23 | + PropertyPrivateSet(QVariantList, x) \ |
| 24 | + public: \ |
| 25 | + void append##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \ |
| 26 | + void remove##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \ |
| 27 | + int count##x()const {return _##x.length();} \ |
| 28 | + t item##x##At(int i) {return _##x.at(i).value<t>();} \ |
| 29 | + bool item##t##Exist(const t& i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
| 30 | + |
| 31 | +// t: type, x: property name |
| 32 | +#define MetaPropertyPublicSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 33 | + PropertyPublicSet(QVariantList, x) \ |
| 34 | + public: \ |
| 35 | + void append##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \ |
| 36 | + void remove##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \ |
| 37 | + int count##x()const {return _##x.length();} \ |
| 38 | + t item##x##At(int i) {return _##x.at(i).value<t>();} |
| 39 | + |
21 | 40 | // t: type, x: property name
|
22 | 41 | #define PropertyPrivateSet_Ptr(t, x) private: t* _##x; \
|
23 | 42 | public: t* x() {return _##x;} \
|
|
64 | 83 | void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
|
65 | 84 | void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
|
66 | 85 | int count##t()const {return _##x.length();} \
|
67 |
| - t* item##t##At(int i) {return _##x.at(i).value<t*>();} |
| 86 | + t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
| 87 | + bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
68 | 88 |
|
69 | 89 | // t: type, x: property name
|
70 | 90 | #define MetaPropertyPublicSet_Ptr_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \
|
|
73 | 93 | void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
|
74 | 94 | void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
|
75 | 95 | int count##t()const {return _##x.length();} \
|
76 |
| - t* item##t##At(int i) {return _##x.at(i).value<t*>();} |
| 96 | + t* item##t##At(int i) {return _##x.at(i).value<t*>();} \ |
| 97 | + bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
77 | 98 |
|
78 | 99 |
|
79 | 100 | /**
|
|
0 commit comments