aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickvisualdatamodel_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/qquickvisualdatamodel_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/qquickvisualdatamodel_p.h')
-rw-r--r--src/quick/items/qquickvisualdatamodel_p.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/items/qquickvisualdatamodel_p.h b/src/quick/items/qquickvisualdatamodel_p.h
index 9e5e3a4511..ba9130abaa 100644
--- a/src/quick/items/qquickvisualdatamodel_p.h
+++ b/src/quick/items/qquickvisualdatamodel_p.h
@@ -160,9 +160,9 @@ public:
void setDefaultInclude(bool include);
Q_INVOKABLE QDeclarativeV8Handle get(int index);
- Q_INVOKABLE QObject *create(int index);
public Q_SLOTS:
+ void create(QDeclarativeV8Function *);
void remove(QDeclarativeV8Function *);
void addGroups(QDeclarativeV8Function *);
void removeGroups(QDeclarativeV8Function *);
@@ -178,7 +178,7 @@ private:
Q_DECLARE_PRIVATE(QQuickVisualDataGroup)
};
-class QQuickVisualDataModelCacheItem;
+class QQuickVisualDataModelItem;
class QQuickVisualDataModelAttachedMetaObject;
class QQuickVisualDataModelAttached : public QObject
{
@@ -194,7 +194,7 @@ public:
{}
~QQuickVisualDataModelAttached() { attachedProperties.remove(parent()); }
- void setCacheItem(QQuickVisualDataModelCacheItem *item);
+ void setCacheItem(QQuickVisualDataModelItem *item);
QQuickVisualDataModel *model() const;
@@ -218,7 +218,7 @@ Q_SIGNALS:
void groupsChanged();
public:
- QQuickVisualDataModelCacheItem *m_cacheItem;
+ QQuickVisualDataModelItem *m_cacheItem;
int m_previousGroups;
int m_previousIndex[QDeclarativeListCompositor::MaximumGroupCount];
bool m_modelChanged;