forked from qt-creator/qt-creator
QmlDesigner: Adding support for QML_DESIGNER_IMPORT_PATH in .pro file
The user can set QML_DESIGNER_IMPORT_PATH to define a qml import path just for qml2puppet. Change-Id: Ic9dac4cf478c9d0f8d6e066d6a9a481500cc5497 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -2010,6 +2010,8 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
|
||||
result->newVarValues[ConfigVar] = input.readerExact->values(QLatin1String("CONFIG"));
|
||||
result->newVarValues[QmlImportPathVar] = input.readerExact->absolutePathValues(
|
||||
QLatin1String("QML_IMPORT_PATH"), input.projectDir);
|
||||
result->newVarValues[QmlDesignerImportPathVar] = input.readerExact->absolutePathValues(
|
||||
QLatin1String("QML_DESIGNER_IMPORT_PATH"), input.projectDir);
|
||||
result->newVarValues[Makefile] = input.readerExact->values(QLatin1String("MAKEFILE"));
|
||||
result->newVarValues[QtVar] = input.readerExact->values(QLatin1String("QT"));
|
||||
result->newVarValues[ObjectExt] = input.readerExact->values(QLatin1String("QMAKE_EXT_OBJ"));
|
||||
|
@@ -94,6 +94,7 @@ enum QmakeVariable {
|
||||
ConfigVar,
|
||||
QtVar,
|
||||
QmlImportPathVar,
|
||||
QmlDesignerImportPathVar,
|
||||
Makefile,
|
||||
ObjectExt,
|
||||
ObjectsDir,
|
||||
|
@@ -36,6 +36,8 @@
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <qmakeprojectmanager/qmakeproject.h>
|
||||
#include <qmakeprojectmanager/qmakenodes.h>
|
||||
#include <coreplugin/messagebox.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
@@ -388,6 +390,21 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
||||
}
|
||||
|
||||
QStringList importPaths = m_model->importPaths();
|
||||
|
||||
|
||||
if (m_currentProject) {
|
||||
for (const QString &fileName : m_currentProject->files(ProjectExplorer::Project::SourceFiles)) {
|
||||
QFileInfo fileInfo(fileName);
|
||||
if (fileInfo.fileName() == "qtquickcontrols2.conf")
|
||||
environment.appendOrSet("QT_QUICK_CONTROLS_CONF", fileName);
|
||||
}
|
||||
QmakeProjectManager::QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject *>(m_currentProject);
|
||||
if (qmakeProject) {
|
||||
QStringList designerImports = qmakeProject->rootProjectNode()->variableValue(QmakeProjectManager::QmlDesignerImportPathVar);
|
||||
importPaths.append(designerImports);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_availablePuppetType == FallbackPuppet)
|
||||
importPaths.append(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath));
|
||||
if (m_availablePuppetType != FallbackPuppet)
|
||||
@@ -398,14 +415,6 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
||||
qCInfo(puppetStart) << "Puppet import paths:" << importPaths;
|
||||
qCInfo(puppetStart) << "Puppet environment:" << environment.toStringList();
|
||||
|
||||
if (m_currentProject) {
|
||||
for (const QString &fileName : m_currentProject->files(ProjectExplorer::Project::SourceFiles)) {
|
||||
QFileInfo fileInfo(fileName);
|
||||
if (fileInfo.fileName() == "qtquickcontrols2.conf")
|
||||
environment.appendOrSet("QT_QUICK_CONTROLS_CONF", fileName);
|
||||
}
|
||||
}
|
||||
|
||||
return environment.toProcessEnvironment();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user