Pass the new node in ProjectTree::currentNodeChanged

Avoids some roundtrips asking for ProjectTree::currentNode()
which traverses the project tree every time.

Change-Id: I650728eab5a47a7f4760cf88844a4b7106365255
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2021-06-18 08:46:38 +02:00
parent 1ae5787e38
commit 2e09518e9c
12 changed files with 43 additions and 39 deletions

View File

@@ -86,7 +86,7 @@ public:
void activeTargetChanged();
void updateActions();
void updateRunQMakeAction();
void updateContextActions();
void updateContextActions(Node *node);
void buildStateChanged(Project *pro);
void updateBuildFileAction();
void disableBuildFileMenus();
@@ -496,7 +496,7 @@ void QmakeProjectManagerPluginPrivate::activeTargetChanged()
void QmakeProjectManagerPluginPrivate::updateActions()
{
updateRunQMakeAction();
updateContextActions();
updateContextActions(ProjectTree::currentNode());
}
void QmakeProjectManagerPluginPrivate::updateRunQMakeAction()
@@ -515,9 +515,8 @@ void QmakeProjectManagerPluginPrivate::updateRunQMakeAction()
m_runQMakeAction->setEnabled(enable);
}
void QmakeProjectManagerPluginPrivate::updateContextActions()
void QmakeProjectManagerPluginPrivate::updateContextActions(Node *node)
{
const Node *node = ProjectTree::currentNode();
Project *project = ProjectTree::currentProject();
const ContainerNode *containerNode = node ? node->asContainerNode() : nullptr;
@@ -578,7 +577,7 @@ void QmakeProjectManagerPluginPrivate::buildStateChanged(Project *pro)
{
if (pro == ProjectTree::currentProject()) {
updateRunQMakeAction();
updateContextActions();
updateContextActions(ProjectTree::currentNode());
updateBuildFileAction();
}
}