summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlvmemetaobject_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-02-22 04:56:49 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-02-22 05:53:27 (GMT)
commit33eb76f050b45718d87926a8ff7afc89d6201c16 (patch)
tree935ddc2337b3891aab1ad7edcb06a62aabf14668 /src/declarative/qml/qmlvmemetaobject_p.h
parent5f63321e3fe2b436d469d2722dc464ea4c7830c4 (diff)
downloadQt-33eb76f050b45718d87926a8ff7afc89d6201c16.zip
Qt-33eb76f050b45718d87926a8ff7afc89d6201c16.tar.gz
Qt-33eb76f050b45718d87926a8ff7afc89d6201c16.tar.bz2
Replace QmlList* and QList* support with a single QmlListProperty type
As a value type QmlListProperty doesn't consume any memory in the object. It also has a companion QmlListReference class that is part of the public API for C++ developers to interact with that also manages memory issues that existed with previous solutions (if the containing QObject was destroyed it left a dangling pointer).
Diffstat (limited to 'src/declarative/qml/qmlvmemetaobject_p.h')
-rw-r--r--src/declarative/qml/qmlvmemetaobject_p.h31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h
index 7fa46fd..3eb776e 100644
--- a/src/declarative/qml/qmlvmemetaobject_p.h
+++ b/src/declarative/qml/qmlvmemetaobject_p.h
@@ -138,33 +138,18 @@ private:
QAbstractDynamicMetaObject *parent;
void listChanged(int);
- class List : public QmlConcreteList<QObject*>
+ class List : public QList<QObject*>
{
public:
- List(QmlVMEMetaObject *p, int propIdx)
- : parent(p), parentProperty(propIdx) { }
-
- virtual void append(QObject *v) {
- QmlConcreteList<QObject*>::append(v);
- parent->listChanged(parentProperty);
- }
- virtual void insert(int i, QObject *v) {
- QmlConcreteList<QObject*>::insert(i, v);
- parent->listChanged(parentProperty);
- }
- virtual void clear() {
- QmlConcreteList<QObject*>::clear();
- parent->listChanged(parentProperty);
- }
- virtual void removeAt(int i) {
- QmlConcreteList<QObject*>::removeAt(i);
- parent->listChanged(parentProperty);
- }
- private:
- QmlVMEMetaObject *parent;
- int parentProperty;
+ List(int lpi) : notifyIndex(lpi) {}
+ int notifyIndex;
};
QList<List *> listProperties;
+
+ static void list_append(QmlListProperty<QObject> *, QObject *);
+ static int list_count(QmlListProperty<QObject> *);
+ static QObject *list_at(QmlListProperty<QObject> *, int);
+ static void list_clear(QmlListProperty<QObject> *);
};
QT_END_NAMESPACE