diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 722838a0930..0a4c56c2ff5 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -40,7 +40,6 @@ #include "parser/qmljsast_p.h" #include -#include #include #include @@ -1581,10 +1580,9 @@ const Value *Function::invoke(const Activation *activation) const QHash CppQmlTypesLoader::builtinObjects; QHash > CppQmlTypesLoader::builtinPackages; -void CppQmlTypesLoader::loadQmlTypes(const QFileInfoList &qmlTypeFiles) +void CppQmlTypesLoader::loadQmlTypes(const QFileInfoList &qmlTypeFiles, QStringList *errors, QStringList *warnings) { QHash newObjects; - Core::MessageManager *messageManager = Core::MessageManager::instance(); foreach (const QFileInfo &qmlTypeFile, qmlTypeFiles) { QString error, warning; @@ -1601,14 +1599,14 @@ void CppQmlTypesLoader::loadQmlTypes(const QFileInfoList &qmlTypeFiles) error = file.errorString(); } if (!error.isEmpty()) { - messageManager->printToOutputPane( - TypeDescriptionReader::tr("Errors while loading qmltypes from %1:\n%2").arg( - qmlTypeFile.absoluteFilePath(), error)); + errors->append(TypeDescriptionReader::tr( + "Errors while loading qmltypes from %1:\n%2").arg( + qmlTypeFile.absoluteFilePath(), error)); } if (!warning.isEmpty()) { - messageManager->printToOutputPane( - TypeDescriptionReader::tr("Warnings while loading qmltypes from %1:\n%2").arg( - qmlTypeFile.absoluteFilePath(), warning)); + warnings->append(TypeDescriptionReader::tr( + "Warnings while loading qmltypes from %1:\n%2").arg( + qmlTypeFile.absoluteFilePath(), error)); } } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index b644b9dad19..8402e0af1fe 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -615,9 +615,10 @@ class QMLJS_EXPORT CppQmlTypesLoader { public: /** Loads a set of qmltypes files into the builtin objects list - and prints any errors to the General Messages pane + and returns errors and warnings */ - static void loadQmlTypes(const QFileInfoList &qmltypesFiles); + static void loadQmlTypes(const QFileInfoList &qmltypesFiles, + QStringList *errors, QStringList *warnings); static QHash builtinObjects; static QHash > builtinPackages; diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 6a48b6fea9c..411dc0364a0 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -118,7 +119,15 @@ void ModelManager::loadQmlTypeDescriptions(const QString &resourcePath) QDir::Files, QDir::Name); - Interpreter::CppQmlTypesLoader::loadQmlTypes(qmlTypesFiles); + QStringList errors; + QStringList warnings; + Interpreter::CppQmlTypesLoader::loadQmlTypes(qmlTypesFiles, &errors, &warnings); + + Core::MessageManager *messageManager = Core::MessageManager::instance(); + foreach (const QString &error, errors) + messageManager->printToOutputPane(error); + foreach (const QString &warning, warnings) + messageManager->printToOutputPane(warning); // disabled for now: Prefer the xml file until the type dumping functionality // has been moved into Qt.