diff options
author | Marco Benelli <marco.benelli@theqtcompany.com> | 2015-12-04 15:56:07 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-12-17 14:06:47 +0000 |
commit | 4b018848f7a7055976895de8a4b8208b58a36fac (patch) | |
tree | 0a7f67cd91437e5ef806446d802b96476c9e3e86 /src/qml/qml/qqmlimport.cpp | |
parent | f89d8294f930914a8f7b933719596e2e3ebf1773 (diff) |
qml: preserve composite singleton types.
Composite singleton types used to always have version -1,-1; regardless
of what is written in qmldir.
Change-Id: Ia193e73695e57095f6a09b97768805f2f23cd56a
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index f6f8c6e51e..d538199520 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -125,7 +125,9 @@ bool isPathAbsolute(const QString &path) } // If the type does not already exist as a file import, add the type and return the new type -QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeName, bool isCompositeSingleton, QList<QQmlError> *errors) +QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeName, + bool isCompositeSingleton, QList<QQmlError> *errors, + int majorVersion=-1, int minorVersion=-1) { QUrl url(urlString); QQmlType *ret = QQmlMetaType::qmlType(url); @@ -140,8 +142,8 @@ QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeNa QQmlPrivate::RegisterCompositeSingletonType reg = { url, "", //Empty URI indicates loaded via file imports - -1, - -1, + majorVersion, + minorVersion, buf.constData() }; ret = QQmlMetaType::qmlTypeFromIndex(QQmlPrivate::qmlregister(QQmlPrivate::CompositeSingletonRegistration, ®)); @@ -149,8 +151,8 @@ QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeNa QQmlPrivate::RegisterCompositeType reg = { url, "", //Empty URI indicates loaded via file imports - -1, - -1, + majorVersion, + minorVersion, buf.constData() }; ret = QQmlMetaType::qmlTypeFromIndex(QQmlPrivate::qmlregister(QQmlPrivate::CompositeRegistration, ®)); @@ -416,6 +418,8 @@ void findCompositeSingletons(const QQmlImportNamespace &set, QList<QQmlImports:: QQmlImports::CompositeSingletonReference ref; ref.typeName = cit->typeName; ref.prefix = set.prefix; + ref.majorVersion = cit->majorVersion; + ref.minorVersion = cit->minorVersion; resultList.append(ref); } } @@ -656,7 +660,10 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader, } if (candidate != end) { - QQmlType *returnType = getTypeForUrl(componentUrl, type, isCompositeSingleton, 0); + int major = vmajor ? *vmajor : -1; + int minor = vminor ? *vminor : -1; + QQmlType *returnType = getTypeForUrl(componentUrl, type, isCompositeSingleton, 0, + major, minor); if (type_return) *type_return = returnType; return returnType != 0; |