aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-12-03 00:03:45 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-01-18 12:51:38 +0100
commit26a97ace7cb9491a325f400b019d40f9413f0a68 (patch)
treee06e6763f8fa355c89118289ea0404e04c0962e3 /src/qml/qml/qqmlmetatype.cpp
parent47d6539c24f689b8056aba34919688188734d2ee (diff)
Move QJSEnginePrivate::cache() to QQmlMetaType
It is just in line with the other propertyCache() methods, and should be treated the same way. The comment made no sense anymore. This allows us to drop more engine pointers. Change-Id: I2e9b479b555c7f771b619e4693d59cbfcf244df6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index 44c005c2da..8c68b438f8 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1279,6 +1279,19 @@ QQmlType QQmlMetaType::qmlType(const QUrl &unNormalizedUrl, bool includeNonFileI
return QQmlType();
}
+/*!
+Returns a QQmlPropertyCache for \a obj if one is available.
+
+If \a obj is null, being deleted or contains a dynamic meta object,
+nullptr is returned.
+*/
+QQmlRefPointer<QQmlPropertyCache> QQmlMetaType::propertyCache(QObject *obj, QTypeRevision version)
+{
+ if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted)
+ return QQmlRefPointer<QQmlPropertyCache>();
+ return QQmlMetaType::propertyCache(obj->metaObject(), version);
+}
+
QQmlRefPointer<QQmlPropertyCache> QQmlMetaType::propertyCache(
const QMetaObject *metaObject, QTypeRevision version)
{