aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
diff options
context:
space:
mode:
authorMarcus Tillmanns <[email protected]>2022-10-25 08:57:49 +0200
committerMarcus Tillmanns <[email protected]>2022-11-08 09:54:10 +0000
commit129448d61dfe2a283d293272a04e9b2d7542c28a (patch)
tree8ba41d47e68435f7f81ed956c432d93a187e1259 /src/libs/qmljs/qmljsmodelmanagerinterface.cpp
parentfe376af66bca8d826336a14701b2e427d4bc5a3e (diff)
QmlJS: Fix Follow under cursor
When trying to jump to a symbol in a qml file the Qml Model may find the location in a generated .qml file in the build folder. QtCreator searches in all generated .qrc files to try and find the source file so it can jump to it instead. Previously not all auto-generated ".rcc" folders would be found as only the folders of targets (executables) were searched. Plugins or Static Libraries were not searched. With this fix, all projects nodes are searched for the ".rcc" folder and therefore also finds them for Dynamic / Static libraries and plugins. Fixes: QTCREATORBUG-27173 Change-Id: Ic51ac8fbc82c15785cbefd76787942a512ecf3db Reviewed-by: <[email protected]> Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/libs/qmljs/qmljsmodelmanagerinterface.cpp')
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index fc31c30e1b7..9229ad7009d 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -432,15 +432,13 @@ bool pInfoLessThanImports(const ModelManagerInterface::ProjectInfo &p1,
}
-static QList<Utils::FilePath> generatedQrc(QList<Utils::FilePath> applicationDirectories)
+static QSet<Utils::FilePath> generatedQrc(
+ const QList<ModelManagerInterface::ProjectInfo> &projectInfos)
{
- QList<Utils::FilePath> res;
- for (const Utils::FilePath &path : applicationDirectories) {
- Utils::FilePath generatedQrcDir = path.pathAppended(".rcc");
- if (generatedQrcDir.isReadableDir()) {
- for (const Utils::FilePath & qrcPath: generatedQrcDir.dirEntries(FileFilter(QStringList({QStringLiteral(u"*.qrc")}), QDir::Files)))
- res.append(qrcPath.canonicalPath());
- }
+ QSet<Utils::FilePath> res;
+ for (const auto &pInfo : projectInfos) {
+ for (const auto &generatedQrcFile: pInfo.generatedQrcFiles)
+ res.insert(generatedQrcFile);
}
return res;
}
@@ -467,7 +465,7 @@ void ModelManagerInterface::iterateQrcFiles(
qrcFilePaths = pInfo.activeResourceFiles;
else
qrcFilePaths = pInfo.allResourceFiles;
- for (const Utils::FilePath &p : generatedQrc(pInfo.applicationDirectories))
+ for (const Utils::FilePath &p : generatedQrc({pInfo}))
qrcFilePaths.append(p);
for (const Utils::FilePath &qrcFilePath : std::as_const(qrcFilePaths)) {
if (pathsChecked.contains(qrcFilePath))
@@ -590,7 +588,7 @@ void ModelManagerInterface::updateProjectInfo(const ProjectInfo &pinfo, ProjectE
m_qrcContents = pinfo.resourceFileContents;
for (const Utils::FilePath &newQrc : std::as_const(pinfo.allResourceFiles))
m_qrcCache.addPath(newQrc.toString(), m_qrcContents.value(newQrc));
- for (const Utils::FilePath &newQrc : generatedQrc(pinfo.applicationDirectories))
+ for (const Utils::FilePath &newQrc : pinfo.generatedQrcFiles)
m_qrcCache.addPath(newQrc.toString(), m_qrcContents.value(newQrc));
for (const Utils::FilePath &oldQrc : std::as_const(oldInfo.allResourceFiles))
m_qrcCache.removePath(oldQrc.toString());
@@ -1293,7 +1291,7 @@ void ModelManagerInterface::updateImportPaths()
allImportPaths.maybeInsert(path, Dialect::Qml);
findNewQmlApplicationInPath(path, snapshot, this, &newLibraries);
}
- for (const Utils::FilePath &qrcPath : generatedQrc(allApplicationDirectories))
+ for (const Utils::FilePath &qrcPath : generatedQrc(m_projects.values()))
updateQrcFile(qrcPath);
updateSourceFiles(importedFiles, true);
@@ -1625,8 +1623,10 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfo() c
}
ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfoForProject(
- ProjectExplorer::Project *) const
+ ProjectExplorer::Project *project, const FilePaths &hiddenRccFolders) const
{
+ Q_UNUSED(project);
+ Q_UNUSED(hiddenRccFolders);
return ModelManagerInterface::ProjectInfo();
}