diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-05-31 15:48:45 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2017-08-01 11:24:53 +0000 |
commit | 45046f7071f6f4886d697547b508cbd087daf342 (patch) | |
tree | 5524bb8e5bb0b559323b84b4381a967b8f901eee /src/plugins/resourceeditor/resourcenode.cpp | |
parent | bbb54cdebae2d2a2a275c69e4d4309a83087a02a (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/resourceeditor/resourcenode.cpp')
-rw-r--r-- | src/plugins/resourceeditor/resourcenode.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index cb7b5be887..48bdac0a9b 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -160,7 +160,7 @@ public: ResourceTopLevelNode *topLevel, ResourceFolderNode *prefixNode); QString displayName() const final; - bool supportsAction(ProjectAction, Node *node) const final; + bool supportsAction(ProjectAction, const Node *node) const final; bool addFiles(const QStringList &filePaths, QStringList *notAdded) final; bool removeFiles(const QStringList &filePaths, QStringList *notRemoved) final; bool renameFile(const QString &filePath, const QString &newFilePath) final; @@ -199,7 +199,7 @@ SimpleResourceFolderNode::SimpleResourceFolderNode(const QString &afolderName, c } -bool SimpleResourceFolderNode::supportsAction(ProjectAction action, Node *) const +bool SimpleResourceFolderNode::supportsAction(ProjectAction action, const Node *) const { return action == AddNewFile || action == AddExistingFile @@ -389,7 +389,7 @@ QString ResourceTopLevelNode::addFileFilter() const return QLatin1String("*.png; *.jpg; *.gif; *.svg; *.ico; *.qml; *.qml.ui"); } -bool ResourceTopLevelNode::supportsAction(ProjectAction action, Node *node) const +bool ResourceTopLevelNode::supportsAction(ProjectAction action, const Node *node) const { if (node != this) return false; @@ -507,7 +507,7 @@ ResourceFolderNode::~ResourceFolderNode() } -bool ResourceFolderNode::supportsAction(ProjectAction action, Node *node) const +bool ResourceFolderNode::supportsAction(ProjectAction action, const Node *node) const { Q_UNUSED(node) @@ -672,7 +672,7 @@ QString ResourceFileNode::qrcPath() const return m_qrcPath; } -bool ResourceFileNode::supportsAction(ProjectAction action, Node *node) const +bool ResourceFileNode::supportsAction(ProjectAction action, const Node *node) const { if (action == HidePathActions) return false; |