1
|
1 #ifndef QQOBJECTENTITY_H
|
|
2 #define QQOBJECTENTITY_H
|
|
3
|
248
|
4 #include "qtd_core.h"
|
|
5 #include <qobject.h>
|
|
6 #include <iostream>
|
|
7
|
|
8 QTD_EXPORT(void, qtd_delete_d_qobject, (void* dPtr))
|
1
|
9
|
248
|
10 #ifdef CPP_SHARED
|
|
11 #define qtd_delete_d_qobject qtd_get_qtd_delete_d_qobject()
|
|
12 #endif
|
|
13
|
|
14 //TODO: user data ID must be registered with QObject::registerUserData;
|
|
15 #define userDataId 0
|
|
16
|
|
17 class QtD_QObjectEntity : public QtD_Entity, public QObjectUserData
|
1
|
18 {
|
|
19 public:
|
248
|
20
|
|
21 QtD_QObjectEntity(QObject *qObject, void *dId) : QtD_Entity(dId)
|
|
22 {
|
|
23 qObject->setUserData(userDataId, this);
|
|
24 }
|
1
|
25
|
248
|
26 virtual ~QtD_QObjectEntity()
|
|
27 {
|
|
28 qtd_delete_d_qobject(dId);
|
|
29 }
|
|
30
|
|
31 inline static QtD_QObjectEntity* getQObjectEntity(const QObject *qObject)
|
|
32 {
|
|
33 return static_cast<QtD_QObjectEntity*>(qObject->userData(userDataId));
|
|
34 }
|
1
|
35 };
|
|
36
|
|
37 #endif // QQOBJECTENTITY_H
|