Debian Codegraph @

super-macros/QQmlListPropertyHelper.h

raw symbols SCIP
1 #ifndef QQMLLISTPROPERTYHELPER
2 #define QQMLLISTPROPERTYHELPER
3
4 #include <QList>
5 #include <QQmlListProperty>
6
7 #define QML_LIST_PROPERTY(CLASS, NAME, TYPE) \
8 public: \
9 static int NAME##_count (QQmlListProperty<TYPE> * prop) { \
10 CLASS * instance = qobject_cast<CLASS *> (prop->object); \
11 return (instance != NULL ? instance->m_##NAME.count () : 0); \
12 } \
13 static void NAME##_clear (QQmlListProperty<TYPE> * prop) { \
14 CLASS * instance = qobject_cast<CLASS *> (prop->object); \
15 if (instance != NULL) { \
16 instance->m_##NAME.clear (); \
17 } \
18 } \
19 static void NAME##_append (QQmlListProperty<TYPE> * prop, TYPE * obj) { \
20 CLASS * instance = qobject_cast<CLASS *> (prop->object); \
21 if (instance != NULL && obj != NULL) { \
22 instance->m_##NAME.append (obj); \
23 } \
24 } \
25 static TYPE * NAME##_at (QQmlListProperty<TYPE> * prop, int idx) { \
26 CLASS * instance = qobject_cast<CLASS *> (prop->object); \
27 return (instance != NULL ? instance->m_##NAME.at (idx) : NULL); \
28 } \
29 QList<TYPE *> get_##NAME##s (void) const { \
30 return m_##NAME; \
31 } \
32 private: \
33 QList<TYPE *> m_##NAME;
34
35 #endif // QQMLLISTPROPERTYHELPER
36