From 4b4e9be3ea5a267c8fc05d6ff5aca972d64eb705 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 17 Mar 2010 17:38:02 +0100 Subject: Another fix to find Do not try to instantiate types that are explicitely forbidden in the qmldir (because the version does not match). --- src/declarative/qml/qdeclarativeengine.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index ce4a9f1..a097b02 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1385,6 +1385,7 @@ struct QDeclarativeEnginePrivate::ImportedNamespace { QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml")); QString qmldircontent = qmlDirContent.at(i); + bool typeWasDeclaredInQmldir = false; if (!qmldircontent.isEmpty()) { const QString typeName = QString::fromUtf8(type); @@ -1394,8 +1395,9 @@ struct QDeclarativeEnginePrivate::ImportedNamespace { qmldirParser.parse(); foreach (const QDeclarativeDirParser::Component &c, qmldirParser.components()) { // ### TODO: cache the components - if (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion)) { - if (c.typeName == typeName) { + if (c.typeName == typeName) { + typeWasDeclaredInQmldir = true; + if (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion)) { if (url_return) *url_return = url.resolved(QUrl(c.fileName)); return true; @@ -1404,7 +1406,7 @@ struct QDeclarativeEnginePrivate::ImportedNamespace { } } - if (!isLibrary.at(i)) { + if (!typeWasDeclaredInQmldir && !isLibrary.at(i)) { // XXX search non-files too! (eg. zip files, see QT-524) QFileInfo f(toLocalFileOrQrc(url)); if (f.exists()) { -- cgit v0.12