Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
Medical Imaging Interaction Toolkit
QmitkDataStorageSimpleTreeModel.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 QMITKDATASTORAGESIMPLETREEMODEL_H
14 #define QMITKDATASTORAGESIMPLETREEMODEL_H
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 // qt widgets module
20 
22 
37 {
38  Q_OBJECT
39 
40 public:
41  QmitkDataStorageSimpleTreeModel(QObject *parent);
43 
44  // override from 'QmitkAbstractDataStorageModel'
45  /*
46  * @brief See 'QmitkAbstractDataStorageModel'
47  */
48  void DataStorageChanged() override;
49  /*
50  * @brief See 'QmitkAbstractDataStorageModel'
51  */
52  void NodePredicateChanged() override;
53  /*
54  * @brief See 'QmitkAbstractDataStorageModel'
55  */
56  void NodeAdded(const mitk::DataNode *node) override;
57  /*
58  * @brief See 'QmitkAbstractDataStorageModel'
59  */
60  void NodeChanged(const mitk::DataNode *node) override;
61  /*
62  * @brief See 'QmitkAbstractDataStorageModel'
63  */
64  void NodeRemoved(const mitk::DataNode *node) override;
65 
66  // override pure virtual from 'QAbstractItemModel'
67  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
68  QModelIndex parent(const QModelIndex &child) const override;
69 
70  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
71  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
72 
73  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
74 
75  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
76 
77  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
78  Qt::ItemFlags flags(const QModelIndex &index) const override;
79 
80 protected:
82 
83 private:
84  void UpdateModelData();
85  void AddNodeInternal(const mitk::DataNode *node);
86 
87  mitk::DataNode *GetParentNode(const mitk::DataNode *node) const;
88 
89  TreeItem *TreeItemFromIndex(const QModelIndex &index) const;
90  QModelIndex IndexFromTreeItem(TreeItem *item) const;
91 
92  void ResetTree();
93 
94  TreeItem *m_Root;
95 
98  std::list<const TreeItem*> m_TreeItems;
99 };
100 
101 #endif // QMITKDATASTORAGESIMPLETREEMODEL_H
virtual void NodePredicateChanged()=0
virtual void DataStorageChanged()=0
#define MITKQTWIDGETS_EXPORT
virtual void NodeChanged(const mitk::DataNode *node)=0
virtual void NodeRemoved(const mitk::DataNode *node)=0
virtual void NodeAdded(const mitk::DataNode *node)=0
The &#39;QmitkDataStorageSimpleTreeModel&#39; is a basic tree model, derived from the &#39;QmitkAbstractDataStora...
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63