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/modeleditor | |
parent | ce9b3358fb56fa78afc24f5b2f17c544ffbd9b7f (diff) |
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/modeleditor')
-rw-r--r-- | src/plugins/modeleditor/pxnodeutilities.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/plugins/modeleditor/pxnodeutilities.cpp b/src/plugins/modeleditor/pxnodeutilities.cpp index 7e6c986a50..861f05bd91 100644 --- a/src/plugins/modeleditor/pxnodeutilities.cpp +++ b/src/plugins/modeleditor/pxnodeutilities.cpp @@ -66,21 +66,9 @@ void PxNodeUtilities::setDiagramSceneController(qmt::DiagramSceneController *dia QString PxNodeUtilities::calcRelativePath(const ProjectExplorer::Node *node, const QString &anchorFolder) { - QString nodePath; - - switch (node->nodeType()) { - case ProjectExplorer::NodeType::File: - { - QFileInfo fileInfo = node->filePath().toFileInfo(); - nodePath = fileInfo.path(); - break; - } - case ProjectExplorer::NodeType::Folder: - case ProjectExplorer::NodeType::VirtualFolder: - case ProjectExplorer::NodeType::Project: - nodePath = node->filePath().toString(); - break; - } + const QString nodePath = node->isFileNodeType() + ? node->filePath().toFileInfo().path() + : node->filePath().toString(); return qmt::NameController::calcRelativePath(nodePath, anchorFolder); } |