Commit f0d5ad71 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlProject: Don't add Qt import on command line

Actually this can lead to crashes if passing the QtQuick1 import
path to qmlscene.

The removed code was introduced in 404186a9

. However,
the Qt import path for the code model is also added in
QmlProject::refresh().

Task-number: QTCREATORBUG-8365
Change-Id: I8581ce3d67c83c0f27d7b8aefedf9765935bedbc
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent d80c2276
......@@ -170,7 +170,7 @@ void QmlProject::refresh(RefreshOptions options)
QmlJS::ModelManagerInterface::ProjectInfo pinfo(this);
pinfo.sourceFiles = files();
pinfo.importPaths = importPaths();
pinfo.importPaths = customImportPaths();
QtSupport::BaseQtVersion *version = 0;
if (activeTarget()) {
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(activeTarget()->kit());
......@@ -220,26 +220,12 @@ bool QmlProject::validProjectFile() const
return !m_projectItem.isNull();
}
QStringList QmlProject::importPaths() const
QStringList QmlProject::customImportPaths() const
{
QStringList importPaths;
if (m_projectItem)
importPaths = m_projectItem.data()->importPaths();
// add the default import path for the target Qt version
if (activeTarget()) {
const QmlProjectRunConfiguration *runConfig =
qobject_cast<QmlProjectRunConfiguration*>(activeTarget()->activeRunConfiguration());
if (runConfig) {
const QtSupport::BaseQtVersion *qtVersion = runConfig->qtVersion();
if (qtVersion && qtVersion->isValid()) {
const QString qtVersionImportPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS");
if (!qtVersionImportPath.isEmpty())
importPaths += qtVersionImportPath;
}
}
}
return importPaths;
}
......
......@@ -87,7 +87,7 @@ public:
QDir projectDir() const;
QStringList files() const;
QString mainFile() const;
QStringList importPaths() const;
QStringList customImportPaths() const;
bool addFiles(const QStringList &filePaths);
......
......@@ -144,7 +144,7 @@ QString QmlProjectRunConfiguration::viewerArguments() const
// arguments from .qmlproject file
QmlProject *project = static_cast<QmlProject *>(target()->project());
foreach (const QString &importPath, project->importPaths()) {
foreach (const QString &importPath, project->customImportPaths()) {
Utils::QtcProcess::addArg(&args, "-I");
Utils::QtcProcess::addArg(&args, importPath);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment