From 0d909c353c54ecf2fee2d13b7d2fe19eee01591d Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 16 Jan 2023 17:03:26 +0100 Subject: Designer: Update C++ code model on an object name change in designer We try to locate the old symbol name in the generated ui header and rename the symbol in the background. Task-number: QTCREATORBUG-1179 Change-Id: Iaf68e3922cd728cbc87d0dc97125e34b8bdaa6be Reviewed-by: Reviewed-by: David Schulz --- src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp | 15 +++++++++++++++ src/plugins/qmakeprojectmanager/qmakeparsernodes.h | 1 + src/plugins/qmakeprojectmanager/qmakeproject.cpp | 5 +++++ src/plugins/qmakeprojectmanager/qmakeproject.h | 2 ++ 4 files changed, 23 insertions(+) (limited to 'src/plugins/qmakeprojectmanager') diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp index a1c34a528d..d7d0a854c4 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp @@ -2080,6 +2080,21 @@ QList QmakeProFile::extraCompilers() const return m_extraCompilers; } +ExtraCompiler *QmakeProFile::extraCompilerForSource(const Utils::FilePath &sourceFile) +{ + for (ExtraCompiler * const ec : std::as_const(m_extraCompilers)) { + if (ec->source() == sourceFile) + return ec; + } + for (QmakePriFile * const priFile : std::as_const(m_children)) { + if (const auto proFile = dynamic_cast(priFile)) { + if (ExtraCompiler * const ec = proFile->extraCompilerForSource(sourceFile)) + return ec; + } + } + return nullptr; +} + void QmakeProFile::setupExtraCompiler(const FilePath &buildDir, const FileType &fileType, ExtraCompilerFactory *factory) { diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h index 86a3a97b49..f9700b7f54 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h @@ -301,6 +301,7 @@ public: const Utils::FilePath &sourceFile, const ProjectExplorer::FileType &sourceFileType) const; QList extraCompilers() const; + ProjectExplorer::ExtraCompiler *extraCompilerForSource(const Utils::FilePath &sourceFile); TargetInformation targetInformation() const; InstallsList installsList() const; diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 5d021f9c56..84188df03f 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -532,6 +532,11 @@ void QmakeBuildSystem::scheduleUpdateAllNowOrLater() scheduleUpdateAll(QmakeProFile::ParseLater); } +ExtraCompiler *QmakeBuildSystem::extraCompilerForSource(const Utils::FilePath &source) +{ + return m_rootProFile->extraCompilerForSource(source); +} + QmakeBuildConfiguration *QmakeBuildSystem::qmakeBuildConfiguration() const { return static_cast(BuildSystem::buildConfiguration()); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h index b83468a108..edf2db0edf 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.h +++ b/src/plugins/qmakeprojectmanager/qmakeproject.h @@ -163,6 +163,8 @@ public: void scheduleUpdateAllNowOrLater(); private: + ProjectExplorer::ExtraCompiler *extraCompilerForSource(const Utils::FilePath &source) override; + void scheduleUpdateAll(QmakeProFile::AsyncUpdateDelay delay); void scheduleUpdateAllLater() { scheduleUpdateAll(QmakeProFile::ParseLater); } -- cgit v1.2.1