CMakePM: Fix AUTOUIC ui_header.h file code completion

The wrong header was reported to the extraCompiler when AUTOUIC was set.

Fixes: QTCREATORBUG-28787
Change-Id: I92d37e56ee5e45229545184e4f4911764834ed67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Cristian Adam
2023-08-04 16:46:42 +02:00
parent 66d49e6a53
commit c4e15769ec

View File

@@ -654,9 +654,17 @@ FilePaths CMakeBuildSystem::filesGeneratedFrom(const FilePath &sourceFile) const
FilePath generatedFilePath = buildConfiguration()->buildDirectory().resolvePath(relativePath);
if (sourceFile.suffix() == "ui") {
generatedFilePath = generatedFilePath
.pathAppended("ui_" + sourceFile.completeBaseName() + ".h");
return {generatedFilePath};
const QString generatedFileSuffix = "ui_" + sourceFile.completeBaseName() + ".h";
// If AUTOUIC reports the generated header file name, use that path
FilePaths generatedFilePaths = this->project()->files([generatedFileSuffix](const Node *n) {
return Project::GeneratedFiles(n) && n->filePath().endsWith(generatedFileSuffix);
});
if (generatedFilePaths.empty())
generatedFilePaths = {generatedFilePath.pathAppended(generatedFileSuffix)};
return generatedFilePaths;
}
if (sourceFile.suffix() == "scxml") {
generatedFilePath = generatedFilePath.pathAppended(sourceFile.completeBaseName());