Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkDataStorageComboBox.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 QmitkDataStorageComboBox_h
14 #define QmitkDataStorageComboBox_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 // Own Includes
19 #include "mitkDataNode.h"
20 #include "mitkDataStorage.h"
21 #include "mitkNodePredicateBase.h"
22 #include "mitkWeakPointer.h"
23 
24 // Toolkit Includes
25 #include <QComboBox>
26 #include <map>
27 
39 {
40  Q_OBJECT
41 
42 public:
46  QmitkDataStorageComboBox(QWidget *parent = nullptr, bool autoSelectNewNodes = false);
47 
52  const mitk::NodePredicateBase *predicate,
53  QWidget *parent = nullptr,
54  bool autoSelectNewNodes = false);
55 
59  ~QmitkDataStorageComboBox() override;
60 
64  virtual int Find(const mitk::DataNode *dataNode) const;
65 
66 public:
70  mitk::DataStorage::Pointer GetDataStorage() const;
74  const mitk::NodePredicateBase::ConstPointer GetPredicate() const;
78  virtual mitk::DataNode::Pointer GetNode(int index) const;
82  virtual mitk::DataNode::Pointer GetSelectedNode() const;
86  mitk::DataStorage::SetOfObjects::ConstPointer GetNodes() const;
91  virtual bool GetAutoSelectNewItems();
92 
93 public:
98  void SetDataStorage(mitk::DataStorage *dataStorage);
103  void SetPredicate(const mitk::NodePredicateBase *predicate);
107  virtual void AddNode(const mitk::DataNode *dataNode);
112  virtual void RemoveNode(int index);
116  virtual void RemoveNode(const mitk::DataNode *dataNode);
121  virtual void SetNode(int index, const mitk::DataNode *dataNode);
126  virtual void SetNode(const mitk::DataNode *dataNode, const mitk::DataNode *otherDataNode);
130  virtual void SetAutoSelectNewItems(bool autoSelectNewItems);
134  virtual void OnPropertyListChanged(const itk::Object *caller, const itk::EventObject &event);
135 
136 signals:
140  void OnSelectionChanged(const mitk::DataNode *);
141 
142 protected:
146  bool HasIndex(unsigned int index) const;
147 
148 protected slots:
152  void OnCurrentIndexChanged(int);
153 
154 public slots:
158  void SetSelectedNode(const mitk::DataNode::Pointer& node);
159 
160 protected:
171  virtual void InsertNode(int index, const mitk::DataNode *dataNode);
172 
176  void Init();
177 
181  virtual void Reset();
182 
183  void RemoveNodeAndPropertyLists(int index);
184 
185  virtual void UpdateComboBoxText(const mitk::PropertyList*);
186 
187 protected:
193 
199 
203  std::vector<mitk::DataNode *> m_Nodes;
204 
209 
214 
219 
223 };
224 
225 #endif // QmitkDataStorageComboBox_h
std::vector< long > m_BaseDatapropertyListObserverTags
Holds the tags of the base data property observers.
Data management class that handles &#39;was created by&#39; relations.
Displays all or a subset (defined by a predicate) of nodes of the Data Storage.
std::vector< mitk::DataNode * > m_Nodes
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
#define MITKQTWIDGETS_EXPORT
Key-value list holding instances of BaseProperty.
bool m_AutoSelectNewNodes
If set to "true" new Nodes will be automatically selected.
#define AddNode(name)
bool m_BlockEvents
Event function guard. Each function which is called by an event mechanism first checks if this is tru...
mitk::NodePredicateBase::ConstPointer m_Predicate
Holds the predicate that is responsible for the dataNode selection of this ComboBox. If the predicate is 0, every dataNode will be selected.
std::vector< long > m_DataNodePropertyListObserverTags
Holds the tags of the data node property observers.
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57