aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/projectnodes.h
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2017-03-15 15:46:48 +0100
committerhjk <hjk@qt.io>2017-04-05 12:47:03 +0000
commitbd5e2faa756f1c852a0d7ae019561413e5278cc3 (patch)
treee1d0680c4e5e5fa9aeb6db14ecbc48c6d67ceae8 /src/plugins/projectexplorer/projectnodes.h
parent8410c0bbad626c8ca38a161968c71a09ffb47df7 (diff)
ProjectNodes: Handle supported actions one-by-one
Getting the full list for a node can get quite expensive e.g. in cases of recursive calls of QMakeProjectManager::findPriFile. However, the FlatModel needs to decide quickly on whether an item is editable to potentially allow renaming. So split up QList<Actions> supportedActions() into individual bool supportsAction(action) calls and make sure Rename is not on the critical path. Task-number: QTCREATORBUG-17953 Change-Id: I31841847f8aa7d7b94c63d76ce71efb1c930fa69 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/projectnodes.h')
-rw-r--r--src/plugins/projectexplorer/projectnodes.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h
index 4ed5b4eb56..efb94d7079 100644
--- a/src/plugins/projectexplorer/projectnodes.h
+++ b/src/plugins/projectexplorer/projectnodes.h
@@ -130,7 +130,7 @@ public:
virtual QString tooltip() const;
bool isEnabled() const;
- virtual QList<ProjectAction> supportedActions(Node *node) const;
+ virtual bool supportsAction(ProjectAction action, Node *node) const;
void setEnabled(bool enabled);
void setAbsoluteFilePathAndLine(const Utils::FileName &filePath, int line);
@@ -179,6 +179,7 @@ public:
static QList<FileNode *> scanForFiles(const Utils::FileName &directory,
const std::function<FileNode *(const Utils::FileName &fileName)> factory,
QFutureInterface<QList<FileNode *>> *future = nullptr);
+ bool supportsAction(ProjectAction action, Node *node) const override;
private:
FileType m_fileType;
@@ -225,6 +226,8 @@ public:
virtual QString addFileFilter() const;
+ bool supportsAction(ProjectAction action, Node *node) const override;
+
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
virtual bool deleteFiles(const QStringList &filePaths);
@@ -309,7 +312,7 @@ public:
ContainerNode(Project *project);
QString displayName() const final;
- QList<ProjectAction> supportedActions(Node *node) const final;
+ bool supportsAction(ProjectAction action, Node *node) const final;
ContainerNode *asContainerNode() final { return this; }
const ContainerNode *asContainerNode() const final { return this; }