CMake: fix not disconnected build action

The old code was disconnecting all signals from CMakeProjectPlugin
to m_buildTargetContextAction. The result was more and more triggered
actions.

Change-Id: I8d7db5852c03d5388870a7460efb3a8a28fd0749
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Alexander Drozdov <adrozdoff@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Tim Jenssen
2016-12-09 03:05:07 +01:00
parent b91632e642
commit 6bf4157491
2 changed files with 4 additions and 3 deletions

View File

@@ -117,12 +117,12 @@ void CMakeProjectPlugin::updateContextActions(ProjectExplorer::Node *node,
CMakeProject *cmProject = dynamic_cast<CMakeProject *>(project);
// Build Target:
disconnect(m_buildTargetContextAction);
disconnect(m_actionConnect);
m_buildTargetContextAction->setParameter(targetDisplayName);
m_buildTargetContextAction->setEnabled(targetNode);
m_buildTargetContextAction->setVisible(targetNode);
if (cmProject && targetNode) {
connect(m_buildTargetContextAction, &Utils::ParameterAction::triggered,
cmProject, [cmProject, targetDisplayName]() { cmProject->buildCMakeTarget(targetDisplayName); });
m_actionConnect = connect(m_buildTargetContextAction, &Utils::ParameterAction::triggered,
cmProject, [cmProject, targetDisplayName]() { cmProject->buildCMakeTarget(targetDisplayName); });
}
}

View File

@@ -66,6 +66,7 @@ private:
void updateContextActions(ProjectExplorer::Node *node, ProjectExplorer::Project *project);
Utils::ParameterAction *m_buildTargetContextAction = nullptr;
QMetaObject::Connection m_actionConnect;
};
} // namespace Internal