summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qmlpackage.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-15 04:29:47 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-15 04:29:47 (GMT)
commit72480e97f0eb4ef49b380e46899a976cf97e78c4 (patch)
tree4aea0651fafe0eb8503195e13927588adf97d48b /src/declarative/util/qmlpackage.cpp
parent4a665ff5da05860f5eb46e3982ef3d8163a6cf59 (diff)
parentd45e7d09675f5dca5d18e2810c8cd8ae6b023279 (diff)
downloadQt-72480e97f0eb4ef49b380e46899a976cf97e78c4.zip
Qt-72480e97f0eb4ef49b380e46899a976cf97e78c4.tar.gz
Qt-72480e97f0eb4ef49b380e46899a976cf97e78c4.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/util/qmlpackage.cpp')
-rw-r--r--src/declarative/util/qmlpackage.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp
index f9238ca..3214dc8 100644
--- a/src/declarative/util/qmlpackage.cpp
+++ b/src/declarative/util/qmlpackage.cpp
@@ -42,6 +42,7 @@
#include "qmlpackage_p.h"
#include <private/qobject_p.h>
+#include "private/qmlguard_p.h"
QT_BEGIN_NAMESPACE
@@ -50,7 +51,28 @@ class QmlPackagePrivate : public QObjectPrivate
public:
QmlPackagePrivate() {}
- QmlConcreteList<QObject *> dataList;
+ class DataList;
+ struct DataGuard : public QmlGuard<QObject>
+ {
+ DataGuard(QObject *obj, DataList *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
+ DataList *list;
+ void objectDestroyed(QObject *) {
+ // we assume priv will always be destroyed after objectDestroyed calls
+ list->removeOne(*this);
+ }
+ };
+
+ class DataList : public QList<DataGuard>, public QmlList<QObject*>
+ {
+ public:
+ virtual void append(QObject* v) { QList<DataGuard>::append(DataGuard(v, this)); }
+ virtual void insert(int i, QObject* v) { QList<DataGuard>::insert(i, DataGuard(v, this)); }
+ virtual void clear() { QList<DataGuard>::clear(); }
+ virtual QObject* at(int i) const { return QList<DataGuard>::at(i); }
+ virtual void removeAt(int i) { QList<DataGuard>::removeAt(i); }
+ virtual int count() const { return QList<DataGuard>::count(); }
+ };
+ DataList dataList;
};
class QmlPackageAttached : public QObject