From 4876ea6a18ccdfd72014582aa5d50ab9f6b6ec9e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sat, 15 Aug 2015 01:31:13 +0200 Subject: Fix performance of ListModel::get() When called, the function would return a full-fledged QObject that maps the list element addressed. It would contain a _copy_ of all values in the list item and it would create a new meta-object for each list element. This function exists for the JavaScript API, and therefore we now return a much more lightweight object. For compatbility reasons it still has to be a QObject, but the meta-object of it is created on-demand, i.e. only when accessing properties from the C++ side or when connecting to the changed signal of a property. Otherwise the JavaScript wrapper will return the live values from the model without copying them. Change-Id: Iabf3ca22192d2aee06ae9d4b4cfb2fcde2a021b1 Reviewed-by: Lars Knoll Reviewed-by: Michael Brasser Reviewed-by: Spencer Schumann --- src/qml/qml/qqmlopenmetaobject_p.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/qml/qml/qqmlopenmetaobject_p.h') diff --git a/src/qml/qml/qqmlopenmetaobject_p.h b/src/qml/qml/qqmlopenmetaobject_p.h index 6a29d08d4e..75ce9addd6 100644 --- a/src/qml/qml/qqmlopenmetaobject_p.h +++ b/src/qml/qml/qqmlopenmetaobject_p.h @@ -54,6 +54,7 @@ public: QQmlOpenMetaObjectType(const QMetaObject *base, QQmlEngine *engine); ~QQmlOpenMetaObjectType(); + void createProperties(const QVector &names); int createProperty(const QByteArray &name); int propertyOffset() const; @@ -101,6 +102,8 @@ public: QQmlOpenMetaObjectType *type() const; + void emitPropertyNotification(const QByteArray &propertyName); + protected: virtual int metaCall(QMetaObject::Call _c, int _id, void **_a); virtual int createProperty(const char *, const char *); -- cgit v1.2.3