aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/util/qqmladaptormodel_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-10-31 13:02:51 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2019-02-21 10:55:03 +0000
commit99e2356a734fa3eb55ffc2e983658d17ab4c3e9f (patch)
tree6bcb7aa33c0cee20a363fb4c0378acd635cefbd2 /src/qml/util/qqmladaptormodel_p.h
parent3b9ecd6174a7a6eacf22b5088b66b203160bfdbd (diff)
QQmlAdaptorModel::Accessors: create a propertyCache for all accessors, not just for QAIM
From before, only accessors for wrapping a QAbstractItemModel had to create a dynamic QMetaObject together with a shared QQmlPropertyCache (for enabling model roles in the delegate). Each model item in the view would get a QQmlData with the dynamic property cache assigned, which would then later be used by the v4 runtime during property lookup. But after we added the properties 'row' and 'column' to the model items, we now always need to create a property cache, regardless of the Accessor used. That way we can we specify the correct metaObject revision of the model item in the cache, which will also allow us to revision the new properties so that they will be respected by the v4 runtime. In this patch we hard-code the revision (modelItemRevision) to be 0, but this will change in a subsequent patch. This patch will move the 'metaObject' and 'propertyCache' up to the base class (Accessor), and ensure that we create a property cache for each of the non-pure-virtual sub classes. The model item wrappers will then, when creating a QQmlData, assign the shared cache from the associated Accessor. Task-number: QTBUG-70031 Change-Id: If6a67d5968d360d4a2b23d8291669c0549e8a342 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/util/qqmladaptormodel_p.h')
-rw-r--r--src/qml/util/qqmladaptormodel_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h
index b5e0881078..4ce3b0703a 100644
--- a/src/qml/util/qqmladaptormodel_p.h
+++ b/src/qml/util/qqmladaptormodel_p.h
@@ -104,12 +104,17 @@ public:
return QVariant(); }
virtual bool canFetchMore(const QQmlAdaptorModel &) const { return false; }
virtual void fetchMore(QQmlAdaptorModel &) const {}
+
+ QScopedPointer<QMetaObject, QScopedPointerPodDeleter> metaObject;
+ QQmlRefPointer<QQmlPropertyCache> propertyCache;
};
const Accessors *accessors;
QPersistentModelIndex rootIndex;
QQmlListAccessor list;
+ int modelItemRevision = 0;
+
QQmlAdaptorModel();
~QQmlAdaptorModel();