From df01daa06b7fc2b6e24e3854038479919c6b3f8e Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Tue, 21 Sep 2010 14:55:11 +0200 Subject: [PATCH] Qml app wizard: Write import path to pro file. Done-with: Alessandro Portale --- share/qtcreator/templates/qmlapp/app.pro | 4 ++++ .../wizards/qmlstandaloneapp.cpp | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/share/qtcreator/templates/qmlapp/app.pro b/share/qtcreator/templates/qmlapp/app.pro index 2a6cda0595a..74669876dc4 100644 --- a/share/qtcreator/templates/qmlapp/app.pro +++ b/share/qtcreator/templates/qmlapp/app.pro @@ -5,6 +5,10 @@ folder_01.target = qml DEPLOYMENTFOLDERS = folder_01 # DEPLOYMENTFOLDERS_END # +# Additional import path used to resolve Qml modules in Creator's code model +# QML_IMPORT_PATH # +QML_IMPORT_PATH = + # Avoid auto screen rotation # ORIENTATIONLOCK # DEFINES += ORIENTATIONLOCK diff --git a/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp b/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp index 5d86244f027..2977cde7dcd 100644 --- a/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp +++ b/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp @@ -248,6 +248,21 @@ void QmlStandaloneApp::handleCurrentProFileTemplateLine(const QString &line, // ### disabled for now; figure out the private headers problem first. //uncommentNextLine = true; Q_UNUSED(uncommentNextLine); + } else if (line.contains(QLatin1String("# QML_IMPORT_PATH"))) { + QString nextLine = proFileTemplate.readLine(); // eats 'QML_IMPORT_PATH =' + if (!nextLine.startsWith(QLatin1String("QML_IMPORT_PATH ="))) + return; + + proFile << nextLine; + + const QLatin1String separator(" \\\n "); + const QDir proPath(path(AppProPath)); + foreach (const QString &importPath, m_importPaths) { + const QString relativePath = proPath.relativeFilePath(importPath); + proFile << separator << relativePath; + } + + proFile << endl; } } -- GitLab