From 4d3a64c5e65a781acb4acf4ba641456da28bd1e4 Mon Sep 17 00:00:00 2001 From: Alan Alpert <416365416c@gmail.com> Date: Sun, 16 Dec 2012 21:24:14 -0800 Subject: Add Composite Types to QQmlType When a composite type is loaded from a QML file, it now generates a QQmlType entry in QQmlMetaTypeData. Change-Id: I9b127dff7955456aacb25138fa6ea8efb7bb9221 Reviewed-by: Christopher Adams Reviewed-by: Alan Alpert --- src/qml/qml/qqmlmetatype_p.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/qml/qml/qqmlmetatype_p.h') diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index 8d3aad519e..497afffb5d 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -84,6 +84,8 @@ public: static QQmlType *qmlType(const QMetaObject *); static QQmlType *qmlType(const QMetaObject *metaObject, const QHashedStringRef &module, int version_major, int version_minor); static QQmlType *qmlType(int); + static QQmlType *qmlType(const QUrl &url); + static QQmlType *qmlTypeFromIndex(int); static QMetaProperty defaultProperty(const QMetaObject *); static QMetaProperty defaultProperty(QObject *); @@ -164,6 +166,7 @@ public: bool isSingleton() const; bool isInterface() const; + bool isComposite() const; int typeId() const; int qListTypeId() const; @@ -206,6 +209,7 @@ public: QHash qobjectApis; }; SingletonInstanceInfo *singletonInstanceInfo() const; + QUrl sourceUrl() const; int enumValue(const QHashedStringRef &, bool *ok) const; int enumValue(const QHashedCStringRef &, bool *ok) const; @@ -218,17 +222,19 @@ private: enum RegistrationType { CppType = 0, SingletonType = 1, - InterfaceType = 2 - // In the near future, we should register all types via QQmlType, including Composite types. + InterfaceType = 2, + CompositeType = 3 }; friend QString registrationTypeString(RegistrationType); friend bool checkRegistration(RegistrationType, QQmlMetaTypeData *, const char *, const QString &); friend int registerType(const QQmlPrivate::RegisterType &); friend int registerSingletonType(const QQmlPrivate::RegisterSingletonType &); friend int registerInterface(const QQmlPrivate::RegisterInterface &); + friend int registerCompositeType(const QQmlPrivate::RegisterCompositeType &); QQmlType(int, const QQmlPrivate::RegisterInterface &); QQmlType(int, const QString &, const QQmlPrivate::RegisterSingletonType &); QQmlType(int, const QString &, const QQmlPrivate::RegisterType &); + QQmlType(int, const QString &, const QQmlPrivate::RegisterCompositeType &); ~QQmlType(); QQmlTypePrivate *d; @@ -250,8 +256,8 @@ public: QList singletonTypes(int) const; private: - friend int registerType(const QQmlPrivate::RegisterType &); - friend int registerSingletonType(const QQmlPrivate::RegisterSingletonType &); + //Used by register functions and creates the QQmlTypeModule for them + friend void addTypeToData(QQmlType* type, QQmlMetaTypeData *data); friend struct QQmlMetaTypeData; QQmlTypeModule(); -- cgit v1.2.3