aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/projectnodes.h
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2017-05-31 15:48:45 +0200
committerTim Jenssen <tim.jenssen@qt.io>2017-08-01 11:24:53 +0000
commit45046f7071f6f4886d697547b508cbd087daf342 (patch)
tree5524bb8e5bb0b559323b84b4381a967b8f901eee /src/plugins/projectexplorer/projectnodes.h
parentbbb54cdebae2d2a2a275c69e4d4309a83087a02a (diff)
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>
Diffstat (limited to 'src/plugins/projectexplorer/projectnodes.h')
-rw-r--r--src/plugins/projectexplorer/projectnodes.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h
index d686bf4138..c6158af393 100644
--- a/src/plugins/projectexplorer/projectnodes.h
+++ b/src/plugins/projectexplorer/projectnodes.h
@@ -29,7 +29,6 @@
#include <QFutureInterface>
#include <QIcon>
-#include <QObject>
#include <QStringList>
#include <utils/fileutils.h>
@@ -98,9 +97,8 @@ class ProjectNode;
class ContainerNode;
// Documentation inside.
-class PROJECTEXPLORER_EXPORT Node : public QObject
+class PROJECTEXPLORER_EXPORT Node
{
- Q_OBJECT
public:
enum PriorityLevel {
DefaultPriority = 0,
@@ -133,7 +131,7 @@ public:
bool listInProject() const;
bool isGenerated() const;
- virtual bool supportsAction(ProjectAction action, Node *node) const;
+ virtual bool supportsAction(ProjectAction action, const Node *node) const;
void setEnabled(bool enabled);
void setAbsoluteFilePathAndLine(const Utils::FileName &filePath, int line);
@@ -199,7 +197,7 @@ public:
const std::function<FileNode *(const Utils::FileName &fileName)> factory,
const QList<Core::IVersionControl *> &versionControls,
QFutureInterface<QList<FileNode *>> *future = nullptr);
- bool supportsAction(ProjectAction action, Node *node) const override;
+ bool supportsAction(ProjectAction action, const Node *node) const override;
private:
FileType m_fileType;
@@ -257,7 +255,7 @@ public:
virtual QString addFileFilter() const;
- bool supportsAction(ProjectAction action, Node *node) const override;
+ bool supportsAction(ProjectAction action, const Node *node) const override;
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
@@ -323,7 +321,7 @@ public:
bool deleteFiles(const QStringList &filePaths) override;
bool canRenameFile(const QString &filePath, const QString &newFilePath) override;
bool renameFile(const QString &filePath, const QString &newFilePath) override;
- bool supportsAction(ProjectAction action, Node *node) const override;
+ bool supportsAction(ProjectAction action, const Node *node) const override;
// by default returns false
virtual bool deploysFolder(const QString &folder) const;
@@ -345,7 +343,7 @@ public:
ContainerNode(Project *project);
QString displayName() const final;
- bool supportsAction(ProjectAction action, Node *node) const final;
+ bool supportsAction(ProjectAction action, const Node *node) const final;
ContainerNode *asContainerNode() final { return this; }
const ContainerNode *asContainerNode() const final { return this; }