ProjectNodes: Do not derive Project Nodes from QObject

That should save some memory per node, and since creator has a lot of nodes
(e.g. opening the LLVM project adds about 1 000 000 nodes) this should be
noticeable:-)

Calling update inside ProjectTree::currentNode() and rename it to
findCurrentNode() to make sure it is an still existing pointer.
Also, try to reduce the somehow more expensive currentNode() calls
and sprinkle some const around that usage.

Change-Id: I6a7c5db01a71d53d39544d3013cad557d5b96cdc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Tobias Hunger
2017-05-31 15:48:45 +02:00
committed by Tim Jenssen
parent bbb54cdeba
commit 45046f7071
25 changed files with 129 additions and 125 deletions

View File

@@ -248,7 +248,7 @@ bool Node::isGenerated() const
return (m_flags & FlagIsGenerated) == FlagIsGenerated;
}
bool Node::supportsAction(ProjectAction, Node *) const
bool Node::supportsAction(ProjectAction, const Node *) const
{
return false;
}
@@ -403,7 +403,7 @@ FileNode::scanForFilesWithVersionControls(const Utils::FileName &directory,
return scanForFilesRecursively(directory, factory, visited, future, 0.0, 1000000.0, versionControls);
}
bool FileNode::supportsAction(ProjectAction action, Node *node) const
bool FileNode::supportsAction(ProjectAction action, const Node *node) const
{
if (action == InheritedFromParent)
return true;
@@ -653,7 +653,7 @@ QString FolderNode::addFileFilter() const
return fn ? fn->addFileFilter() : QString();
}
bool FolderNode::supportsAction(ProjectAction action, Node *node) const
bool FolderNode::supportsAction(ProjectAction action, const Node *node) const
{
if (action == InheritedFromParent)
return true;
@@ -831,7 +831,7 @@ bool ProjectNode::renameFile(const QString &filePath, const QString &newFilePath
return false;
}
bool ProjectNode::supportsAction(ProjectAction, Node *) const
bool ProjectNode::supportsAction(ProjectAction, const Node *) const
{
return false;
}
@@ -886,9 +886,9 @@ QString ContainerNode::displayName() const
return name;
}
bool ContainerNode::supportsAction(ProjectAction action, Node *node) const
bool ContainerNode::supportsAction(ProjectAction action, const Node *node) const
{
Node *rootNode = m_project->rootProjectNode();
const Node *rootNode = m_project->rootProjectNode();
return rootNode && rootNode->supportsAction(action, node);
}