diff options
author | hjk <hjk@qt.io> | 2019-02-26 17:44:56 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-03-01 08:32:14 +0000 |
commit | ad4e2562fa732892b717f76779ca56cc52543f1b (patch) | |
tree | a3a65bb6540f09bf02aa9bc739f2f0a66756271e /src/plugins/pythoneditor/pythoneditorplugin.cpp | |
parent | ce9b3358fb56fa78afc24f5b2f17c544ffbd9b7f (diff) | |
download | qt-creator-ad4e2562fa732892b717f76779ca56cc52543f1b.tar.gz |
ProjectExplorer: Replace Node::setNodeType by virtual functions
Not the usual direction of change, but currently there are
several systems to identify or invoke node functionality.
Virtual functions are likely to stay in this context, so this
here attempts to help consolidation by reducing the influence
of the node type flags, hopefully leading to full removal
by making remaining functionality available through the
other mechanisms (virtual functions, asFooNode() 'casts',
less so the FileType flag).
Change-Id: I12a17ce30b3c8883995b29b4720408020ee0fa3e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/pythoneditor/pythoneditorplugin.cpp')
-rw-r--r-- | src/plugins/pythoneditor/pythoneditorplugin.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index b937f9c89e..57db21346c 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -623,18 +623,16 @@ QString PythonProjectNode::addFileFilter() const bool PythonProjectNode::supportsAction(ProjectAction action, const Node *node) const { - switch (node->nodeType()) { - case NodeType::File: + if (node->isFileNodeType()) { return action == ProjectAction::Rename || action == ProjectAction::RemoveFile; - case NodeType::Folder: - case NodeType::Project: + } + if (node->isFolderNodeType() || node->isProjectNodeType()) { return action == ProjectAction::AddNewFile || action == ProjectAction::RemoveFile || action == ProjectAction::AddExistingFile; - default: - return ProjectNode::supportsAction(action, node); } + return ProjectNode::supportsAction(action, node); } bool PythonProjectNode::addFiles(const QStringList &filePaths, QStringList *) |