Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkDataStorageTreeModelInternalItem.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkDataStorageTreeModelInternalItem_h
14 #define QmitkDataStorageTreeModelInternalItem_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 #include <mitkDataNode.h>
19 
20 #include <string>
21 #include <vector>
22 
36  {
37  public:
44 
51 
58 
65 
72 
77  int GetChildCount() const;
78 
83  int GetIndex() const;
84 
90 
95  mitk::DataNode::Pointer GetDataNode() const;
96 
101  std::vector<QmitkDataStorageTreeModelInternalItem *> GetChildren() const;
102 
108 
114 
124 
130 
134  void Delete();
135 
136  protected:
138  std::vector<QmitkDataStorageTreeModelInternalItem *> m_Children;
140  };
141 
142 #endif
#define MITKQTWIDGETS_EXPORT
Helper class representing a node in a tree structure of DataNodes.
QmitkDataStorageTreeModelInternalItem * Find(const mitk::DataNode *_DataNode) const
Recursively searches for the item holding the given DataNode.
int GetChildCount() const
Returns the number of child items.
QmitkDataStorageTreeModelInternalItem(mitk::DataNode *_DataNode, QmitkDataStorageTreeModelInternalItem *_Parent=nullptr)
Constructs a tree item for the given DataNode.
void Delete()
Recursively deletes this item and all its children.
std::vector< QmitkDataStorageTreeModelInternalItem * > m_Children
QmitkDataStorageTreeModelInternalItem * m_Parent
int IndexOfChild(const QmitkDataStorageTreeModelInternalItem *item) const
Returns the index of the given child item.
void AddChild(QmitkDataStorageTreeModelInternalItem *item)
Adds the given item as a child (if not already present).
std::vector< QmitkDataStorageTreeModelInternalItem * > GetChildren() const
Returns all child items as a vector.
void SetParent(QmitkDataStorageTreeModelInternalItem *_Parent)
Sets the parent of this item.
QmitkDataStorageTreeModelInternalItem * GetParent() const
Returns the parent item.
void RemoveChild(QmitkDataStorageTreeModelInternalItem *item)
Removes the given item from this item's child list.
virtual ~QmitkDataStorageTreeModelInternalItem()
Destructor. Removes this item from its parent's child list.
mitk::DataNode::Pointer GetDataNode() const
Returns the DataNode associated with this tree item.
QmitkDataStorageTreeModelInternalItem * GetChild(int index) const
Returns the child item at the given index.
int GetIndex() const
Returns the index of this item within its parent's child list.
void InsertChild(QmitkDataStorageTreeModelInternalItem *item, int index=-1)
Inserts a child item at the given position.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72