|
13 | 13 | public: t x() const {return _##x;} \
|
14 | 14 | private: void x(const t& v){_##x = v;}
|
15 | 15 |
|
| 16 | + |
| 17 | +// t: type, x: property name |
| 18 | +#define PropertyProtectedSet(t, x) private: t _##x; \ |
| 19 | + public: t x() const {return _##x;} \ |
| 20 | + protected: void x(const t& v){_##x = v;} |
| 21 | + |
16 | 22 | // t: type, x: property name
|
17 | 23 | #define PropertyPublicSet(t, x) private: t _##x; \
|
18 | 24 | public: t x() const {return _##x;} \
|
19 | 25 | void x(const t& v){_##x = v;}
|
20 | 26 |
|
| 27 | + |
21 | 28 | // t: type, x: property name
|
22 | 29 | #define MetaPropertyPrivateSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \
|
23 | 30 | PropertyPrivateSet(QVariantList, x) \
|
|
28 | 35 | t item##x##At(int i) {return _##x.at(i).value<t>();} \
|
29 | 36 | bool item##t##Exist(const t& i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;}
|
30 | 37 |
|
| 38 | + |
| 39 | +// t: type, x: property name |
| 40 | +#define MetaPropertyProtectedSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 41 | + PropertyProtectedSet(QVariantList, x) \ |
| 42 | + void append##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \ |
| 43 | + void remove##x(const t& i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \ |
| 44 | + public: \ |
| 45 | + int count##x()const {return _##x.length();} \ |
| 46 | + t item##x##At(int i) {return _##x.at(i).value<t>();} \ |
| 47 | + bool item##t##Exist(const t& i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;} |
| 48 | + |
| 49 | + |
31 | 50 | // t: type, x: property name
|
32 | 51 | #define MetaPropertyPublicSet_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \
|
33 | 52 | PropertyPublicSet(QVariantList, x) \
|
|
42 | 61 | public: t* x() {return _##x;} \
|
43 | 62 | private: void x(t* v){_##x = v;}
|
44 | 63 |
|
| 64 | + |
| 65 | +// t: type, x: property name |
| 66 | +#define PropertyProtectedSet_Ptr(t, x) private: t* _##x; \ |
| 67 | + public: t* x() {return _##x;} \ |
| 68 | + protected: void x(t* v){_##x = v;} |
| 69 | + |
45 | 70 | // t: type, x: property name
|
46 | 71 | #define PropertyPublicSet_Ptr(t, x) private: t* _##x; \
|
47 | 72 | public: t* x() {return _##x;} \
|
|
53 | 78 | public: t* x() {return qobject_cast<t*>(_##x);} \
|
54 | 79 | private: void x(QObject* v){_##x = v;}
|
55 | 80 |
|
| 81 | + |
| 82 | +// t: type, x: property name |
| 83 | +#define PropertyProtectedSet_Ptr_O(t, x) private: QObject* _##x; \ |
| 84 | + public: t* x() {return qobject_cast<t*>(_##x);} \ |
| 85 | + protected: void x(QObject* v){_##x = v;} |
| 86 | + |
56 | 87 | // t: type, x: property name
|
57 | 88 | #define PropertyPublicSet_Ptr_O(t, x) private: QObject* _##x; \
|
58 | 89 | public: t* x() {return qobject_cast<t*>(_##x);} \
|
|
62 | 93 | #define MetaPropertyPrivateSet(t, x) private: Q_PROPERTY(t x READ x WRITE x) \
|
63 | 94 | PropertyPrivateSet(t, x)
|
64 | 95 |
|
| 96 | + |
| 97 | +// t: type, x: property name |
| 98 | +#define MetaPropertyProtectedSet(t, x) private: Q_PROPERTY(t x READ x WRITE x) \ |
| 99 | + PropertyProtectedSet(t, x) |
| 100 | + |
65 | 101 | // t: type, x: property name
|
66 | 102 | #define MetaPropertyPublicSet(t, x) private: Q_PROPERTY(t x READ x WRITE x) \
|
67 | 103 | PropertyPublicSet(t, x)
|
|
71 | 107 | PropertyPrivateSet_Ptr_O(t, x) \
|
72 | 108 | public: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);}
|
73 | 109 |
|
| 110 | + |
| 111 | +// t: type, x: property name |
| 112 | +#define MetaPropertyProtectedSet_Ptr(t, x) private: Q_PROPERTY(QObject* x READ x WRITE x) \ |
| 113 | + PropertyProtectedSet_Ptr_O(t, x) \ |
| 114 | + public: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);} |
| 115 | + |
| 116 | + |
74 | 117 | // t: type, x: property name
|
75 | 118 | #define MetaPropertyPublicSet_Ptr(t, x) private: Q_PROPERTY(QObject* x READ x WRITE x) \
|
76 | 119 | PropertyPublicSet_Ptr_O(t, x) \
|
|
86 | 129 | t* item##t##At(int i) {return _##x.at(i).value<t*>();} \
|
87 | 130 | bool item##t##Exist(t* i) const {QVariant v = QVariant::fromValue(i); if (v.isValid()) { return _##x.contains(v);} else return false;}
|
88 | 131 |
|
| 132 | + |
| 133 | +// t: type, x: property name |
| 134 | +#define MetaPropertyProtectedSet_Ptr_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \ |
| 135 | + PropertyProtectedSet(QVariantList, x) \ |
| 136 | + protected: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);} \ |
| 137 | + void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \ |
| 138 | + 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;} |
| 142 | + |
| 143 | + |
89 | 144 | // t: type, x: property name
|
90 | 145 | #define MetaPropertyPublicSet_Ptr_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \
|
91 | 146 | PropertyPublicSet(QVariantList, x) \
|
|
0 commit comments