forked from qt-creator/qt-creator
ProjectExplorer: Add subscribeSignal method to targets and projects
Add a subscribeSignal method to targets and projects that will make sure all signals of all project configurations added during the lifetime of the project/target will get connected (if the type matches). Use this to connect to some signal in all BuildConfigurations of a project and get rid of code that keeps connecting to the current build configuration. Use Project::buildEnvironmentChanged as an example and convert its usages. Change-Id: I689bcebac4b191bf3f8a18765bf18eaac371c5fe Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -153,13 +153,6 @@ Target::~Target()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Target::changeEnvironment()
|
||||
{
|
||||
auto bc = qobject_cast<BuildConfiguration *>(sender());
|
||||
if (bc == activeBuildConfiguration())
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
void Target::changeBuildConfigurationEnabled()
|
||||
{
|
||||
auto bc = qobject_cast<BuildConfiguration *>(sender());
|
||||
@@ -246,8 +239,6 @@ void Target::addBuildConfiguration(BuildConfiguration *bc)
|
||||
emit addedProjectConfiguration(bc);
|
||||
emit addedBuildConfiguration(bc);
|
||||
|
||||
connect(bc, &BuildConfiguration::environmentChanged,
|
||||
this, &Target::changeEnvironment);
|
||||
connect(bc, &BuildConfiguration::enabledChanged,
|
||||
this, &Target::changeBuildConfigurationEnabled);
|
||||
connect(bc, &BuildConfiguration::buildDirectoryChanged,
|
||||
@@ -303,7 +294,6 @@ void Target::setActiveBuildConfiguration(BuildConfiguration *bc)
|
||||
d->m_activeBuildConfiguration = bc;
|
||||
emit activeProjectConfigurationChanged(d->m_activeBuildConfiguration);
|
||||
emit activeBuildConfigurationChanged(d->m_activeBuildConfiguration);
|
||||
emit environmentChanged();
|
||||
emit buildConfigurationEnabledChanged();
|
||||
emit buildDirectoryChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user