diff options
Diffstat (limited to 'src/declarative/qml/qdeclarativemetatype.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativemetatype.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index 153e2be..a5c878f 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <QtDeclarative/qdeclarativeprivate.h> #include "private/qdeclarativemetatype_p.h" #include "private/qdeclarativeproxymetaobject_p.h" @@ -485,17 +486,17 @@ int QDeclarativeType::index() const return d->m_index; } -int QDeclarativePrivate::registerAutoParentFunction(AutoParentFunction function) +int registerAutoParentFunction(QDeclarativePrivate::RegisterAutoParent &autoparent) { QWriteLocker lock(metaTypeDataLock()); QDeclarativeMetaTypeData *data = metaTypeData(); - data->parentFunctions.append(function); + data->parentFunctions.append(autoparent.function); return data->parentFunctions.count() - 1; } -int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterInterface &interface) +int registerInterface(const QDeclarativePrivate::RegisterInterface &interface) { if (interface.version > 0) qFatal("qmlRegisterType(): Cannot mix incompatible QML versions."); @@ -524,7 +525,7 @@ int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterInterfa return index; } -int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &type) +int registerType(const QDeclarativePrivate::RegisterType &type) { if (type.elementName) { for (int ii = 0; type.elementName[ii]; ++ii) { @@ -576,6 +577,22 @@ int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &t } /* +This method is "over generalized" to allow us to (potentially) register more types of things in +the future without adding exported symbols. +*/ +int QDeclarativePrivate::qmlregister(RegistrationType type, void *data) +{ + if (type == TypeRegistration) { + return registerType(*reinterpret_cast<RegisterType *>(data)); + } else if (type == InterfaceRegistration) { + return registerInterface(*reinterpret_cast<RegisterInterface *>(data)); + } else if (type == AutoParentRegistration) { + return registerAutoParentFunction(*reinterpret_cast<RegisterAutoParent *>(data)); + } + return -1; +} + +/* Have any types been registered for \a module with at least versionMajor.versionMinor, and types for \a module with at most versionMajor.versionMinor. |