diff options
author | Cristian Adam <cristian.adam@qt.io> | 2023-08-04 16:46:42 +0200 |
---|---|---|
committer | Cristian Adam <cristian.adam@qt.io> | 2023-08-04 15:29:25 +0000 |
commit | c4e15769ec43ff46ec08f639c1f09f9fd8872225 (patch) | |
tree | 706e8b42225772a0d1feaf04f06dfd4b8903f48d | |
parent | 66d49e6a53a9c535a9eb277f2bcd50e0fc3f4cfc (diff) |
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>
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 9abb3597d1..329048b19c 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -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()); |