Fix cached compilation units for file imports
authorSimon Hausmann <simon.hausmann@digia.com>
Mon, 19 May 2014 10:22:55 +0000 (12:22 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 26 May 2014 19:28:24 +0000 (21:28 +0200)
If the file doesn't exist in the file system anymore, check if it's at
least in the unit cache, as we can still load it from there. This is
used for file imports where 'import "someDirectory"' results us in trying
to locate someDirectory/<Type>.qml for any instantiation of <Type>.

Change-Id: I590161f1d2d133a49ca1b611d9a7e96d52d0bf13
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/qqmlimport.cpp

index c0b21a943f05dbe511786762d498a1d6eac851df..5799886faa3ab5e53b69afb3d5ec693e10d5d9cf 100644 (file)
@@ -672,6 +672,8 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
             exists = QQmlFile::bundleFileExists(qmlUrl, typeLoader->engine());
         } else {
             exists = !typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(qmlUrl)).isEmpty();
+            if (!exists)
+                exists = QQmlMetaType::findCachedCompilationUnit(QUrl(qmlUrl));
         }
 
         if (exists) {