CMakePM: Fix saving "Initial Configuration" values

Amends 6c5717844d

The CMakeBuildSystem::clearCMakeCache() would call
BuildSystem::emitParsingFinished which would clear the configuration in
the widget, effectively removing any "Initial Configuration" changes when
clicking on the "Re-configure with Initial Parameters" button.

This commit makes sure that the updateInitialCMakeArguments() function
is called before CMakeBuildSystem::clearCMakeCache(), and that only the
"Build > Clear CMake Configuration" action would
"disableCMakeBuildMenuActions" which is what an user would expect.

Fixes: QTCREATORBUG-31320
Change-Id: Ie7810c9bed000ca19a31a6ab8e7a281ae9f5e6f0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2024-07-27 14:41:25 +02:00
parent 01acba9533
commit 59ce9dc04b
4 changed files with 9 additions and 2 deletions

View File

@@ -621,10 +621,10 @@ void CMakeBuildSettingsWidget::reconfigureWithInitialParameters()
if (reply != QMessageBox::Yes)
return;
m_buildConfig->cmakeBuildSystem()->clearCMakeCache();
updateInitialCMakeArguments();
m_buildConfig->cmakeBuildSystem()->clearCMakeCache();
if (ProjectExplorerPlugin::saveModifiedFiles())
m_buildConfig->cmakeBuildSystem()->runCMake();
}

View File

@@ -1239,6 +1239,11 @@ void CMakeBuildSystem::clearCMakeCache()
path.removeRecursively();
emit configurationCleared();
}
void CMakeBuildSystem::disableCMakeBuildMenuActions()
{
emitParsingStarted();
emitParsingFinished(false);
}

View File

@@ -77,6 +77,7 @@ public:
bool persistCMakeState();
void clearCMakeCache();
void disableCMakeBuildMenuActions();
// Context menu actions:
void buildCMakeTarget(const QString &buildTarget);

View File

@@ -262,6 +262,7 @@ void CMakeManager::clearCMakeCache(BuildSystem *buildSystem)
QTC_ASSERT(cmakeBuildSystem, return);
cmakeBuildSystem->clearCMakeCache();
cmakeBuildSystem->disableCMakeBuildMenuActions();
}
void CMakeManager::runCMake(BuildSystem *buildSystem)