diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-08-04 07:23:01 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-04 07:23:01 (GMT) |
commit | a9f932ab1ee658ded7e5246248fded0655e9218a (patch) | |
tree | 07b3829fc3f13ec1fda01cd8d4a6d8b88daf1997 /src/declarative/qml | |
parent | bf3f1cc5be0aa3965117441cb06bf37ce0c6c653 (diff) | |
download | Qt-a9f932ab1ee658ded7e5246248fded0655e9218a.zip Qt-a9f932ab1ee658ded7e5246248fded0655e9218a.tar.gz Qt-a9f932ab1ee658ded7e5246248fded0655e9218a.tar.bz2 |
Fix to use "." not "/" in QML_DEFINE_TYPE URIs
Fix to allow multiple version specifying defines.
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qml.h | 10 | ||||
-rw-r--r-- | src/declarative/qml/qmlcustomparser_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetatype.cpp | 14 | ||||
-rw-r--r-- | src/declarative/qml/qmlprivate.h | 2 |
4 files changed, 16 insertions, 12 deletions
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h index e7fbff3..bced8f2 100644 --- a/src/declarative/qml/qml.h +++ b/src/declarative/qml/qml.h @@ -74,19 +74,19 @@ QT_MODULE(Declarative) QT_BEGIN_NAMESPACE #define QML_DEFINE_INTERFACE(INTERFACE) \ - template<> QmlPrivate::InstanceType QmlPrivate::Define<INTERFACE *>::instance(qmlRegisterInterface<INTERFACE>(#INTERFACE)); + template<> QmlPrivate::InstanceType QmlPrivate::Define<INTERFACE *,0,0,0>::instance(qmlRegisterInterface<INTERFACE>(#INTERFACE)); #define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, NAME, TYPE, EXTENSION) \ - template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE)); + template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN_FROM), (VERSION_MIN_TO)>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE)); #define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, NAME, TYPE) \ - template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *>::instance(qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE)); + template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN_FROM), (VERSION_MIN_TO)>::instance(qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE)); #define QML_DEFINE_EXTENDED_NOCREATE_TYPE(TYPE, EXTENSION) \ - template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#TYPE)); + template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0,0>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#TYPE)); #define QML_DEFINE_NOCREATE_TYPE(TYPE) \ - template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *>::instance(qmlRegisterType<TYPE>(#TYPE)); + template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0,0>::instance(qmlRegisterType<TYPE>(#TYPE)); class QmlContext; class QmlEngine; diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h index 3d55d3e..74bd15c 100644 --- a/src/declarative/qml/qmlcustomparser_p.h +++ b/src/declarative/qml/qmlcustomparser_p.h @@ -113,7 +113,7 @@ public: virtual void setCustomData(QObject *, const QByteArray &); }; #define QML_DEFINE_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MAJ_TO, NAME, TYPE, CUSTOMTYPE) \ - template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *>::instance(qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MAJ_TO, #NAME, #TYPE, new CUSTOMTYPE)); + template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN_FROM), (VERSION_MAJ_TO)>::instance(qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MAJ_TO, #NAME, #TYPE, new CUSTOMTYPE)); QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 5fe3eff..29fe026 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -448,16 +448,20 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser) { Q_UNUSED(object); - QByteArray name = cname; - + QByteArray name; if (uri) { + // Convert to path + name = uri; + name.replace('.','/'); if (version) { - name = QByteArray(uri) + '/' + version + '/' + name; - } else { - name = QByteArray(uri) + '/' + name; + name += '/'; + name += version; } + name += '/'; + name += cname; } else { // No URI? No version! + name = cname; Q_ASSERT(!version); } diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index 3d5fa61..e821759 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -240,7 +240,7 @@ namespace QmlPrivate InstanceType(int); }; - template<typename T> + template<typename T, int VMAJ, int VMIN1, int VMIN2> struct Define { static InstanceType instance; }; |