Helper class representing a node in a tree structure of DataNodes.
More...
#include <QmitkDataStorageTreeModelInternalItem.h>
Helper class representing a node in a tree structure of DataNodes.
This class is used internally by QmitkDataStorageTreeModel and QmitkDataStorageSimpleTreeModel to build an in-memory tree hierarchy that mirrors the parent-child relationships in the DataStorage. Each item holds a weak pointer to a mitk::DataNode and references to its parent and children.
- See also
- QmitkDataStorageTreeModel
-
QmitkDataStorageSimpleTreeModel
Definition at line 35 of file QmitkDataStorageTreeModelInternalItem.h.
◆ QmitkDataStorageTreeModelInternalItem()
Constructs a tree item for the given DataNode.
- Parameters
-
| [in] | _DataNode | The data node to associate with this item. Must not be nullptr. |
| [in] | _Parent | Optional parent item. Defaults to nullptr (root item). |
◆ ~QmitkDataStorageTreeModelInternalItem()
| virtual QmitkDataStorageTreeModelInternalItem::~QmitkDataStorageTreeModelInternalItem |
( |
| ) |
|
|
virtual |
Destructor. Removes this item from its parent's child list.
- Note
- Does not delete child items. Use Delete() to recursively remove an entire branch.
- See also
- Delete
◆ AddChild()
Adds the given item as a child (if not already present).
- Parameters
-
| [in] | item | The item to add as a child. |
◆ Delete()
| void QmitkDataStorageTreeModelInternalItem::Delete |
( |
| ) |
|
Recursively deletes this item and all its children.
◆ Find()
Recursively searches for the item holding the given DataNode.
- Parameters
-
| [in] | _DataNode | The data node to search for. |
- Returns
- Pointer to the matching item, or nullptr if not found.
◆ GetChild()
Returns the child item at the given index.
- Parameters
-
| [in] | index | The zero-based child index. |
- Returns
- Pointer to the child item, or nullptr if the index is out of range.
◆ GetChildCount()
| int QmitkDataStorageTreeModelInternalItem::GetChildCount |
( |
| ) |
const |
Returns the number of child items.
- Returns
- The child count.
◆ GetChildren()
Returns all child items as a vector.
- Returns
- A vector of pointers to child items.
◆ GetDataNode()
| mitk::DataNode::Pointer QmitkDataStorageTreeModelInternalItem::GetDataNode |
( |
| ) |
const |
Returns the DataNode associated with this tree item.
- Returns
- A smart pointer to the data node.
◆ GetIndex()
| int QmitkDataStorageTreeModelInternalItem::GetIndex |
( |
| ) |
const |
Returns the index of this item within its parent's child list.
- Returns
- The zero-based index, or -1 if this item has no parent.
◆ GetParent()
Returns the parent item.
- Returns
- Pointer to the parent item, or nullptr for root items.
◆ IndexOfChild()
Returns the index of the given child item.
- Parameters
-
| [in] | item | The child item to find. |
- Returns
- The zero-based index, or -1 if the item is not a child.
◆ InsertChild()
Inserts a child item at the given position.
If index is out of range (or -1), the item is appended at the end.
- Parameters
-
| [in] | item | The item to insert. |
| [in] | index | The position at which to insert. Defaults to -1 (append). |
◆ RemoveChild()
Removes the given item from this item's child list.
- Parameters
-
| [in] | item | The child item to remove. |
◆ SetParent()
Sets the parent of this item.
- Parameters
-
| [in] | _Parent | The new parent item. |
◆ m_Children
◆ m_DataNode
◆ m_Parent
The documentation for this class was generated from the following file: