diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-07-29 23:34:56 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-08-02 11:19:28 +0000 |
commit | e52ebbf217499e50a00ec35095aaf0f606416491 (patch) | |
tree | 89044e062e2dcc6c9c7aa799192f1dd03bf410ad /src/plugins/autotoolsprojectmanager/makestep.cpp | |
parent | 34456aa906434b2c90ff179b11ba90dc5a273bd6 (diff) |
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>
Diffstat (limited to 'src/plugins/autotoolsprojectmanager/makestep.cpp')
-rw-r--r-- | src/plugins/autotoolsprojectmanager/makestep.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp index b0c5304868..84ebec917a 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.cpp +++ b/src/plugins/autotoolsprojectmanager/makestep.cpp @@ -236,8 +236,15 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep) : makeStep, &MakeStep::setAdditionalArguments); connect(makeStep, &MakeStep::additionalArgumentsChanged, this, &MakeStepConfigWidget::updateDetails); - connect(m_makeStep->project(), &Project::environmentChanged, - this, &MakeStepConfigWidget::updateDetails); + m_makeStep->project()->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this]() { + if (static_cast<BuildConfiguration *>(sender())->isActive()) + updateDetails(); + }); + connect(makeStep->project(), &Project::activeProjectConfigurationChanged, + this, [this](ProjectConfiguration *pc) { + if (pc->isActive()) + updateDetails(); + }); } QString MakeStepConfigWidget::displayName() const |