aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatypedata_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-02-05 15:30:42 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-02-08 16:09:46 +0000
commite2fe9d537c8f86a2e1d9cbfaf801fe58f817e9c5 (patch)
tree79735be4f2887f74b1604882b9216780d7fb0903 /src/qml/qml/qqmlmetatypedata_p.h
parent7fa5ef9e1ce87d9602c12d26442427c8604472ef (diff)
Eliminate excessive friendlyness of QQmlType
QQmlMetaTypeData does need to be exposed to the QQmlType ctors. Rather, we can use factory functions to create the QQmlTypePrivate objects. The static attachedPropertyIds should really be part of QQmlMetaTypeData and access to them should be protected by the lock. Task-number: QTBUG-73271 Change-Id: I154a3842fab03a02c710901a20afd1652364808d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatypedata_p.h')
-rw-r--r--src/qml/qml/qqmlmetatypedata_p.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatypedata_p.h b/src/qml/qml/qqmlmetatypedata_p.h
index cde6294c37..f61adada2c 100644
--- a/src/qml/qml/qqmlmetatypedata_p.h
+++ b/src/qml/qml/qqmlmetatypedata_p.h
@@ -128,8 +128,27 @@ struct QQmlMetaTypeData
qWarning("%s", message.toUtf8().constData());
}
+ int attachedPropertyId(const QMetaObject *metaObject, int ownIndex)
+ {
+ auto iter = attachedPropertyIds.find(metaObject);
+ return (iter == attachedPropertyIds.end())
+ ? *attachedPropertyIds.insert(metaObject, ownIndex)
+ : *iter;
+ }
+
+ bool removeAttachedPropertyId(const QMetaObject *metaObject, int ownIndex)
+ {
+ auto iter = attachedPropertyIds.find(metaObject);
+ if (iter != attachedPropertyIds.end() && *iter == ownIndex) {
+ attachedPropertyIds.erase(iter);
+ return true;
+ }
+ return false;
+ }
+
private:
QStringList *m_typeRegistrationFailures = nullptr;
+ QHash<const QMetaObject *, int> attachedPropertyIds;
};
inline uint qHash(const QQmlMetaTypeData::VersionedUri &v)