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 404186a919. However,
the Qt import path for the code model is also added in
QmlProject::refresh().

Task-number: QTCREATORBUG-8365
Change-Id: I8581ce3d67c83c0f27d7b8aefedf9765935bedbc
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Kai Koehne
2012-12-03 15:28:34 +01:00
parent d80c227636
commit f0d5ad714e
3 changed files with 4 additions and 18 deletions

View File

@@ -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;
}