diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-12-21 14:23:41 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-23 07:23:55 +0100 |
commit | ed361944159a99abe67df7a4a883d5ee6f4ec73f (patch) | |
tree | 209ad261a14389e8fa3640523a92a53576e166c6 /src/quick/items/qquickvisualdatamodel_p_p.h | |
parent | fb00bd445b1d77ffd7be8c60fce30f58e53eb6de (diff) |
VisualDataModel performance improvements.
Avoid a linear scan of all cache items and associated accesses by
getting the cache item from an objects vdm attached object instead.
Make the model context property a property of the context object instead
of a separate property on the context object.
Parent the vdm attached object to the delegate object with
QDeclarative_setParent_noEvent instead of passing it in the constructor.
Change-Id: Ib77c5cdb963f3dfe8f2bdef039e010a6bb30140f
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickvisualdatamodel_p_p.h')
-rw-r--r-- | src/quick/items/qquickvisualdatamodel_p_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/items/qquickvisualdatamodel_p_p.h b/src/quick/items/qquickvisualdatamodel_p_p.h index 03d9767661..7565192ad0 100644 --- a/src/quick/items/qquickvisualdatamodel_p_p.h +++ b/src/quick/items/qquickvisualdatamodel_p_p.h @@ -102,6 +102,7 @@ class QQuickVisualDataModelItem : public QObject, public QV8ObjectResource { Q_OBJECT Q_PROPERTY(int index READ modelIndex NOTIFY modelIndexChanged) + Q_PROPERTY(QObject *model READ modelObject CONSTANT) V8_RESOURCE_TYPE(VisualDataItemType) public: QQuickVisualDataModelItem( @@ -120,6 +121,8 @@ public: void Dispose(); + QObject *modelObject() { return this; } + int modelIndex() const { return index[0]; } void setModelIndex(int idx) { index[0] = idx; emit modelIndexChanged(); } @@ -231,7 +234,6 @@ public: void destroy(QObject *object); QQuickVisualDataModel::ReleaseFlags release(QObject *object); QString stringValue(Compositor::Group group, int index, const QString &name); - int cacheIndexOf(QObject *object) const; void emitCreatedPackage(QQuickVisualDataModelItem *cacheItem, QDeclarativePackage *package); void emitInitPackage(QQuickVisualDataModelItem *cacheItem, QDeclarativePackage *package); void emitCreatedItem(QQuickVisualDataModelItem *cacheItem, QQuickItem *item) { |