Skip to content

Commit c07b2af

Browse files
committed
-count and item getter method added
1 parent 3d94af1 commit c07b2af

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/JObject.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262
PropertyPrivateSet(QVariantList, x) \
6363
public: Q_INVOKABLE void _type##x(const QString& prop){registerPtrProperty(prop, &t::staticMetaObject);} \
6464
void append##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.append(v);}} \
65-
void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}}
65+
void remove##t(t* i){QVariant v = QVariant::fromValue(i); if (v.isValid()) { _##x.removeAll(v);}} \
66+
int count##t()const {return _##x.length();} \
67+
t* item##t##At(int i) {return _##x.at(i).value<t*>();}
6668

6769
// t: type, x: property name
6870
#define MetaPropertyPublicSet_Ptr_List(t, x) private: Q_PROPERTY(QVariantList x READ x WRITE x) \

0 commit comments

Comments
 (0)