forked from qt-creator/qt-creator
QmlProjectManager: Fix for absolute import path problem
Task-number: QDS-10145 Change-Id: I11998b474a25351901ca0eb45716e1d3e309c572 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -236,9 +236,7 @@ QStringList ExternalDependencies::modulePaths() const
|
||||
if (auto path = qmlPath(target); !path.isEmpty())
|
||||
modulePaths.push_back(path);
|
||||
|
||||
for (const QString &modulePath : qmlBuildSystem->customImportPaths())
|
||||
modulePaths.append(project->projectDirectory().pathAppended(modulePath).toString());
|
||||
|
||||
modulePaths.append(qmlBuildSystem->absoluteImportPaths());
|
||||
return modulePaths;
|
||||
}
|
||||
|
||||
@@ -250,10 +248,7 @@ QStringList ExternalDependencies::projectModulePaths() const
|
||||
auto [project, target, qmlBuildSystem] = activeProjectEntries();
|
||||
|
||||
if (project && target && qmlBuildSystem) {
|
||||
QStringList modulePaths;
|
||||
|
||||
for (const QString &modulePath : qmlBuildSystem->customImportPaths())
|
||||
modulePaths.append(project->projectDirectory().pathAppended(modulePath).toString());
|
||||
return qmlBuildSystem->absoluteImportPaths();
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@@ -200,8 +200,8 @@ void QmlBuildSystem::refresh(RefreshOptions options)
|
||||
= modelManager->defaultProjectInfoForProject(project(),
|
||||
project()->files(Project::HiddenRccFolders));
|
||||
|
||||
for (const QString &searchPath : customImportPaths()) {
|
||||
projectInfo.importPaths.maybeInsert(projectDirectory().pathAppended(searchPath),
|
||||
for (const QString &importPath : absoluteImportPaths()) {
|
||||
projectInfo.importPaths.maybeInsert(Utils::FilePath::fromString(importPath),
|
||||
QmlJS::Dialect::Qml);
|
||||
}
|
||||
|
||||
@@ -649,6 +649,16 @@ QStringList QmlBuildSystem::importPaths() const
|
||||
return m_projectItem->importPaths();
|
||||
}
|
||||
|
||||
QStringList QmlBuildSystem::absoluteImportPaths()
|
||||
{
|
||||
return Utils::transform<QStringList>(m_projectItem->importPaths(), [&](const QString &importPath) {
|
||||
Utils::FilePath filePath = Utils::FilePath::fromString(importPath);
|
||||
if (!filePath.isAbsolutePath())
|
||||
return (projectDirectory() / importPath).toString();
|
||||
return projectDirectory().resolvePath(importPath).toString();
|
||||
});
|
||||
}
|
||||
|
||||
Utils::FilePaths QmlBuildSystem::files() const
|
||||
{
|
||||
return m_projectItem->files();
|
||||
|
@@ -68,18 +68,24 @@ public:
|
||||
Utils::FilePath targetFile(const Utils::FilePath &sourceFile) const;
|
||||
|
||||
Utils::EnvironmentItems environment() const;
|
||||
|
||||
QStringList importPaths() const;
|
||||
QStringList absoluteImportPaths();
|
||||
QStringList customImportPaths() const;
|
||||
QStringList customFileSelectors() const;
|
||||
|
||||
bool multilanguageSupport() const;
|
||||
QStringList supportedLanguages() const;
|
||||
void setSupportedLanguages(QStringList languages);
|
||||
|
||||
QString primaryLanguage() const;
|
||||
void setPrimaryLanguage(QString language);
|
||||
|
||||
bool forceFreeType() const;
|
||||
bool widgetApp() const;
|
||||
|
||||
QStringList shaderToolArgs() const;
|
||||
QStringList shaderToolFiles() const;
|
||||
QStringList importPaths() const;
|
||||
Utils::FilePaths files() const;
|
||||
|
||||
QString versionQt() const;
|
||||
|
Reference in New Issue
Block a user