diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-03 17:04:50 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-10 13:45:24 +0200 |
commit | a755d165e8c290ba1b6b64b9d41be98ccdf492e6 (patch) | |
tree | 95144af7968e5e99f8a2e33784e45610df541b76 /src/qml/qml/qqmltype_p_p.h | |
parent | 89292e1bb7367e19afe9c37537b1881b63a27e7f (diff) |
Optimize enum setup
If we have already set up the enums from a property cache or a
metaobject, respectively, we can see that from the flags. Retrieving the
composite property cache is expensive and we can skip it in that case.
Task-number: QTBUG-77237
Change-Id: I63f5e1ca0fc166ec927754bdf5d166b2ce8ff0f6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltype_p_p.h')
-rw-r--r-- | src/qml/qml/qqmltype_p_p.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/qml/qml/qqmltype_p_p.h b/src/qml/qml/qqmltype_p_p.h index d381e11df4..6a2d961de8 100644 --- a/src/qml/qml/qqmltype_p_p.h +++ b/src/qml/qml/qqmltype_p_p.h @@ -66,10 +66,30 @@ public: QQmlTypePrivate(QQmlType::RegistrationType type); void init() const; - void initEnums(const QQmlPropertyCache *cache = nullptr) const; + void initEnums(QQmlEnginePrivate *engine) const; void insertEnums(const QMetaObject *metaObject) const; void insertEnumsFromPropertyCache(const QQmlPropertyCache *cache) const; + QUrl sourceUrl() const + { + switch (regType) { + case QQmlType::CompositeType: + return extraData.fd->url; + case QQmlType::CompositeSingletonType: + return extraData.sd->singletonInstanceInfo->url; + default: + return QUrl(); + } + } + + bool isComposite() const + { + return regType == QQmlType::CompositeType || regType == QQmlType::CompositeSingletonType; + } + + QQmlType resolveCompositeBaseType(QQmlEnginePrivate *engine) const; + QQmlPropertyCache *compositePropertyCache(QQmlEnginePrivate *engine) const; + QQmlType::RegistrationType regType; struct QQmlCppTypeData |