forked from qt-creator/qt-creator
		
	QmlJS: Fix running qmldump on plugins that require a specific uri.
The builtin QML plugins require to be imported with the full uri, i.e. import Qt.labs.particles 1.0 so setting the import path to imports/Qt/labs and doing import particles 1.0 is not supposed to work. (see QTBUG-11139) This change adjusts qmldump to take an import path *and* the import uri, so it will be able to dump the type information for these plugins. Reviewed-by: Erik Verbruggen
This commit is contained in:
		| @@ -33,6 +33,7 @@ | ||||
| #include "qmljsdocument.h" | ||||
| #include "qmljsbind.h" | ||||
| #include "qmljsscopebuilder.h" | ||||
| #include "qmljsmodelmanagerinterface.h" | ||||
|  | ||||
| #include <QtCore/QFileInfo> | ||||
| #include <QtCore/QDir> | ||||
| @@ -302,14 +303,22 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A | ||||
|         if (!dir.cd(packagePath)) | ||||
|             continue; | ||||
|  | ||||
|         const LibraryInfo libraryInfo = _snapshot.libraryInfo(dir.path()); | ||||
|         const QString &libraryPath = dir.path(); | ||||
|         const LibraryInfo libraryInfo = _snapshot.libraryInfo(libraryPath); | ||||
|         if (!libraryInfo.isValid()) | ||||
|             continue; | ||||
|  | ||||
|         importFound = true; | ||||
|  | ||||
|         if (!libraryInfo.plugins().isEmpty()) | ||||
|             engine()->cppQmlTypes().load(engine(), libraryInfo.metaObjects()); | ||||
|         if (!libraryInfo.plugins().isEmpty()) { | ||||
|             if (libraryInfo.metaObjects().isEmpty()) { | ||||
|                 ModelManagerInterface *modelManager = ModelManagerInterface::instance(); | ||||
|                 if (modelManager) | ||||
|                     modelManager->loadPluginTypes(libraryPath, importPath, Bind::toString(import->importUri, QLatin1Char('.'))); | ||||
|             } else { | ||||
|                 engine()->cppQmlTypes().load(engine(), libraryInfo.metaObjects()); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         QSet<QString> importedTypes; | ||||
|         foreach (const QmlDirParser::Component &component, libraryInfo.components()) { | ||||
|   | ||||
| @@ -94,6 +94,8 @@ public: | ||||
|  | ||||
|     virtual QStringList importPaths() const = 0; | ||||
|  | ||||
|     virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri) = 0; | ||||
|  | ||||
| signals: | ||||
|     void documentUpdated(QmlJS::Document::Ptr doc); | ||||
|     void documentChangedOnDisk(QmlJS::Document::Ptr doc); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user