aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickvisualadaptormodel_p.h
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-12-01 14:01:13 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-23 07:23:39 +0100
commit347f84e5aca9423536cb0cd7a2eafaf836a72212 (patch)
treecdb68529b37190be7f477d7775f8011d39080b36 /src/quick/items/qquickvisualadaptormodel_p.h
parent932a195dbaae92ce87b98beca29a25c9b8d6cf5b (diff)
Minimize the number of objects created per item in VisualDataModel.
Derive from QDeclarativeContext and reference count the context object instead of parenting it to the context. Combined with a weak persistent v8 handle the allows the context object to be returned by javascript accessors instead of creating a new instance for every use. In addition to the efficiency advantages of creating fewer objects, routing all data access through a single object means that object can also persist data instead of just acting as a proxy. Change-Id: I107dc8c901f16f2a4b420ff1cbffa7a6be27de89 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickvisualadaptormodel_p.h')
-rw-r--r--src/quick/items/qquickvisualadaptormodel_p.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/items/qquickvisualadaptormodel_p.h b/src/quick/items/qquickvisualadaptormodel_p.h
index 41d913c47e..83ab20f5db 100644
--- a/src/quick/items/qquickvisualadaptormodel_p.h
+++ b/src/quick/items/qquickvisualadaptormodel_p.h
@@ -45,14 +45,15 @@
#include <QtCore/qobject.h>
#include <QtCore/qabstractitemmodel.h>
-#include <private/qdeclarativerefcount_p.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QDeclarativeEngine;
+class QQuickVisualDataModelItem;
+class QQuickVisualDataModelItemMetaType;
+
class QQuickVisualAdaptorModelPrivate;
class QQuickVisualAdaptorModel : public QObject
{
@@ -80,10 +81,9 @@ public:
QVariant parentModelIndex() const;
int count() const;
- QObject *data(int index);
+ QQuickVisualDataModelItem *createItem(QQuickVisualDataModelItemMetaType *metaType, int index);
QString stringValue(int index, const QString &role);
void replaceWatchedRoles(const QList<QByteArray> &oldRoles, const QList<QByteArray> &newRoles);
- int indexOf(QObject *object) const;
bool canFetchMore() const;
void fetchMore();