diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-15 02:51:51 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-15 02:51:51 (GMT) |
commit | c0eb81664f2bae225dcaca897c23564d6f97a3d1 (patch) | |
tree | 354f235d26815bad727df33b849853f06c75a961 /src/declarative/qml/qdeclarativeprivate.h | |
parent | 087e90f089918b939c19133909edb3528fc3e103 (diff) | |
download | Qt-c0eb81664f2bae225dcaca897c23564d6f97a3d1.zip Qt-c0eb81664f2bae225dcaca897c23564d6f97a3d1.tar.gz Qt-c0eb81664f2bae225dcaca897c23564d6f97a3d1.tar.bz2 |
Add QML object destruction hook
Diffstat (limited to 'src/declarative/qml/qdeclarativeprivate.h')
-rw-r--r-- | src/declarative/qml/qdeclarativeprivate.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index bebe82c..6e240d8 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -69,11 +69,18 @@ public: class QDeclarativeCustomParser; namespace QDeclarativePrivate { + void Q_DECLARATIVE_EXPORT qdeclarativeelement_destructor(QObject *); template<typename T> - QObject *create() { return new T; } + class QDeclarativeElement : public T + { + public: + virtual ~QDeclarativeElement() { + QDeclarativePrivate::qdeclarativeelement_destructor(this); + } + }; template<typename T> - void createInto(void *memory) { new (memory) T; } + void createInto(void *memory) { new (memory) QDeclarativeElement<T>; } template<typename T> QObject *createParent(QObject *p) { return new T(p); } |