diff --git a/share/qtcreator/templates/qmlapp/app.pro b/share/qtcreator/templates/qmlapp/app.pro index 2a6cda0595aba59b055051b7499774e921ef8b1a..74669876dc4ac734ef3e2577173b198747741f79 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 5d86244f027e106e96a207dac4b4d39e2aeda087..2977cde7dcda0b93e2a56b6920693e2b6a472867 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; } }