Node Class | Extending Qt Creator Manual

Extending Qt Creator Manual | Node

Extending Qt Creator Manual 4.6.0

# Node Class

(ProjectExplorer::Node)

The Node class is the base class of all nodes in the node hierarchy. More...

Header: | #include <Node>
Inherited By: | ProjectExplorer::FileNode and ProjectExplorer::FolderNode

- List of all members, including inherited members

## Public Types

enum | PriorityLevel { DefaultPriority, DefaultFilePriority, DefaultFolderPriority, DefaultVirtualFolderPriority, DefaultProjectPriority, DefaultProjectFilePriority }

## Public Functions

virtual | ~Node()
virtual ContainerNode * | asContainerNode()
virtual const ContainerNode * | asContainerNode() const
virtual FileNode * | asFileNode()
virtual const FileNode * | asFileNode() const
virtual FolderNode * | asFolderNode()
virtual const FolderNode * | asFolderNode() const
virtual ProjectNode * | asProjectNode()
virtual const ProjectNode * | asProjectNode() const
virtual QString | displayName() const
const Utils::FileName & | filePath() const
QByteArray | id() const
bool | isEnabled() const
bool | isGenerated() const
int | line() const
bool | listInProject() const
ProjectNode * | managingProject()
const ProjectNode * | managingProject() const
NodeType | nodeType() const
FolderNode * | parentFolderNode() const
ProjectNode * | parentProjectNode() const
int | priority() const
void | setAbsoluteFilePathAndLine(const Utils::FileName &filePath, int line)
void | setEnabled(bool enabled)
void | setListInProject(bool l)
void | setParentFolderNode(FolderNode *parentFolder)
virtual bool | supportsAction(ProjectAction action, const Node *node) const
virtual QString | tooltip() const

## Static Public Members

FileType | fileTypeForFileName(const Utils::FileName &file)
FileType | fileTypeForMimeType(const Utils::MimeType &mt)
bool | sortByPath(const Node *a, const Node *b)

## Protected Functions

| Node(NodeType nodeType, const Utils::FileName &filePath, int line = -1, const QByteArray &id = {})
void | setIsGenerated(bool g)
void | setPriority(int priority)

## Detailed Description

The Node class is the base class of all nodes in the node hierarchy.

The nodes are arranged in a tree where leaves are FileNodes and non-leaves are FolderNodes A Project is a special Folder that manages the files and normal folders underneath it.

The Watcher emits signals for structural changes in the hierarchy. A Visitor can be used to traverse all Projects and other Folders.

See also ProjectExplorer::FileNode, ProjectExplorer::FolderNode, ProjectExplorer::ProjectNode, and ProjectExplorer::NodesWatcher.

## Member Type Documentation

### enum Node::PriorityLevel

## Member Function Documentation

### `[protected]` Node::Node(NodeType nodeType, const Utils::FileName &filePath, int line = -1, const QByteArray &id = {})

Default constructs an instance of Node.

### `[virtual]` Node::~Node()

Destroys the instance of Node. The destructor is virtual.

### `[virtual]` ContainerNode *Node::asContainerNode()

### `[virtual]` const ContainerNode *Node::asContainerNode() const

### `[virtual]` FileNode *Node::asFileNode()

### `[virtual]` const FileNode *Node::asFileNode() const

### `[virtual]` FolderNode *Node::asFolderNode()

### `[virtual]` const FolderNode *Node::asFolderNode() const

### `[virtual]` ProjectNode *Node::asProjectNode()

### `[virtual]` const ProjectNode *Node::asProjectNode() const

### `[virtual]` QString Node::displayName() const

### const Utils::FileName &Node::filePath() const

The path of the file or folder in the filesystem the node represents.

### `[static]` FileType Node::fileTypeForFileName(const Utils::FileName &file)

### `[static]` FileType Node::fileTypeForMimeType(const Utils::MimeType &mt)

### QByteArray Node::id() const

### bool Node::isEnabled() const

### bool Node::isGenerated() const

Returns `true` if the file is automatically generated by a compile step.

See also setIsGenerated().

### int Node::line() const

### bool Node::listInProject() const

Returns `true` if the Node should be listed as part of the projects file list.

See also setListInProject().

### ProjectNode *Node::managingProject()

### const ProjectNode *Node::managingProject() const

### NodeType Node::nodeType() const

### FolderNode *Node::parentFolderNode() const

The parent in the node hierarchy.

See also setParentFolderNode().

### ProjectNode *Node::parentProjectNode() const

The project that owns and manages the node. It is the first project in the list of ancestors.

### int Node::priority() const

See also setPriority().

### void Node::setAbsoluteFilePathAndLine(const Utils::FileName &filePath, int line)

### void Node::setEnabled(bool enabled)

See also isEnabled().

### `[protected]` void Node::setIsGenerated(bool g)

See also isGenerated().

### void Node::setListInProject(bool l)

See also listInProject().

### void Node::setParentFolderNode(FolderNode *parentFolder)

See also parentFolderNode().

### `[protected]` void Node::setPriority(int priority)

See also priority().

### `[static]` bool Node::sortByPath(const Node *a, const Node *b)

### `[virtual]` bool Node::supportsAction(ProjectAction action, const Node *node) const

### `[virtual]` QString Node::tooltip() const