Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Displays all or a subset (defined by a predicate) of nodes of the Data Storage. More...
#include <QmitkDataStorageComboBox.h>
Public Slots | |
void | SetSelectedNode (mitk::DataNode::Pointer item) |
Slot for signal when user wants to set a node as current selected node. More... | |
Signals | |
void | OnSelectionChanged (const mitk::DataNode *) |
Throw a signal when the _DataNode selection changed. More... | |
Public Member Functions | |
QmitkDataStorageComboBox (QWidget *parent=nullptr, bool _AutoSelectNewNodes=false) | |
Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards. More... | |
QmitkDataStorageComboBox (mitk::DataStorage *_DataStorage, const mitk::NodePredicateBase *_Predicate, QWidget *parent=nullptr, bool _AutoSelectNewNodes=false) | |
Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate. More... | |
~QmitkDataStorageComboBox () | |
Standard Dtor. Nothing to do here. More... | |
virtual int | Find (const mitk::DataNode *_DataNode) const |
Seaches for a given node and returns a valid index or -1 if the node was not found. More... | |
mitk::DataStorage::Pointer | GetDataStorage () const |
Get the DataStorage this ComboBox listens to. More... | |
const mitk::NodePredicateBase::ConstPointer | GetPredicate () const |
Return the predicate (may be NULL) that is responsible for the _DataNode selection of this ComboBox. More... | |
virtual mitk::DataNode::Pointer | GetNode (int index) const |
Returns the _DataNode at Index index or 0 if the index is out of bounds. More... | |
virtual mitk::DataNode::Pointer | GetSelectedNode () const |
Returns the selected _DataNode or 0 if there is none. More... | |
mitk::DataStorage::SetOfObjects::ConstPointer | GetNodes () const |
Returns all nodes that are stored in this combobox. More... | |
virtual bool | GetAutoSelectNewItems () |
void | SetDataStorage (mitk::DataStorage *dataStorage) |
Set the DataStorage this ComboBox should listen to. More... | |
void | SetPredicate (const mitk::NodePredicateBase *_Predicate) |
Set the predicate for this ComboBox. (QmitkDataStorageComboBox is now owner of the predicate) More... | |
virtual void | AddNode (const mitk::DataNode *_DataNode) |
virtual void | RemoveNode (int index) |
virtual void | RemoveNode (const mitk::DataNode *_DataNode) |
virtual void | SetNode (int index, const mitk::DataNode *_DataNode) |
virtual void | SetNode (const mitk::DataNode *_DataNode, const mitk::DataNode *_OtherDataNode) |
virtual void | SetAutoSelectNewItems (bool _AutoSelectNewItems) |
virtual void | OnDataNodeDeleteOrModified (const itk::Object *caller, const itk::EventObject &event) |
Called when a node is deleted or the name property of the node was modified. Calls RemoveNode or SetNode then. More... | |
Protected Slots | |
void | OnCurrentIndexChanged (int) |
Slot for signal when the user selects another item. More... | |
Protected Member Functions | |
bool | HasIndex (unsigned int index) const |
Checks if the given index is within the range of the m_Nodes vector. More... | |
virtual void | InsertNode (int index, const mitk::DataNode *_DataNode) |
Inserts a new node at the given index. If the index does not exist, the _DataNode is simply appended to the combobox. More... | |
void | Init () |
Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors. More... | |
virtual void | Reset () |
Reset function whenever datastorage or predicate changes. More... | |
Protected Attributes | |
mitk::WeakPointer< mitk::DataStorage > | m_DataStorage |
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. More... | |
std::vector< mitk::DataNode * > | m_Nodes |
std::vector< long > | m_NodesModifiedObserverTags |
Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) More... | |
std::vector< long > | m_NodesDeleteObserverTags |
Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) More... | |
std::map< mitk::DataNode *, const mitk::BaseProperty * > | m_PropertyToNode |
Maps a a specific node to (Name-)property. This is needed because we have to find the assiociated node whenever the name property of a node changed. More... | |
bool | m_BlockEvents |
Event function guard. Each function which is called by an event mechanism first checks if this is true in order to avoid endless loops. More... | |
bool | m_AutoSelectNewNodes |
If set to "true" new Nodes will be automatically selected. More... | |
Displays all or a subset (defined by a predicate) of nodes of the Data Storage.
Dont forget that this class inherits from QComboBox and you can therefore use the whole API of QComboBox.
Definition at line 45 of file QmitkDataStorageComboBox.h.
QmitkDataStorageComboBox::QmitkDataStorageComboBox | ( | QWidget * | parent = nullptr , |
bool | _AutoSelectNewNodes = false |
||
) |
Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards.
Definition at line 23 of file QmitkDataStorageComboBox.cpp.
References Init().
QmitkDataStorageComboBox::QmitkDataStorageComboBox | ( | mitk::DataStorage * | _DataStorage, |
const mitk::NodePredicateBase * | _Predicate, | ||
QWidget * | parent = nullptr , |
||
bool | _AutoSelectNewNodes = false |
||
) |
Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate.
Definition at line 33 of file QmitkDataStorageComboBox.cpp.
References Init(), and SetDataStorage().
QmitkDataStorageComboBox::~QmitkDataStorageComboBox | ( | ) |
Standard Dtor. Nothing to do here.
Definition at line 48 of file QmitkDataStorageComboBox.cpp.
References AddNode(), mitk::DataStorage::AddNodeEvent, mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, m_Nodes, mitk::MessageBase< AbstractDelegate >::RemoveListener(), RemoveNode(), and mitk::DataStorage::RemoveNodeEvent.
|
virtual |
Adds a node to the ComboBox. Gets called everytime a DataStorage Add Event was thrown.
Definition at line 155 of file QmitkDataStorageComboBox.cpp.
References InsertNode(), and m_BlockEvents.
Referenced by Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().
|
virtual |
Seaches for a given node and returns a valid index or -1 if the node was not found.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 281 of file QmitkDataStorageComboBox.cpp.
References m_Nodes.
Referenced by QmitkDataStorageComboBoxWithSelectNone::Find(), InsertNode(), RemoveNode(), SetNode(), and SetSelectedNode().
|
virtual |
Returns the AutoSelectNewItems.
Definition at line 104 of file QmitkDataStorageComboBox.cpp.
References m_AutoSelectNewNodes.
mitk::DataStorage::Pointer QmitkDataStorageComboBox::GetDataStorage | ( | ) | const |
Get the DataStorage this ComboBox listens to.
Definition at line 67 of file QmitkDataStorageComboBox.cpp.
References mitk::WeakPointer< TObjectType >::GetPointer(), and m_DataStorage.
|
virtual |
Returns the _DataNode at Index index or 0 if the index is out of bounds.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 77 of file QmitkDataStorageComboBox.cpp.
References HasIndex(), and m_Nodes.
Referenced by GetSelectedNode().
mitk::DataStorage::SetOfObjects::ConstPointer QmitkDataStorageComboBox::GetNodes | ( | ) | const |
Returns all nodes that are stored in this combobox.
Definition at line 92 of file QmitkDataStorageComboBox.cpp.
References m_Nodes, and mitk::New().
const mitk::NodePredicateBase::ConstPointer QmitkDataStorageComboBox::GetPredicate | ( | ) | const |
Return the predicate (may be NULL) that is responsible for the _DataNode selection of this ComboBox.
Definition at line 72 of file QmitkDataStorageComboBox.cpp.
References m_Predicate.
|
virtual |
Returns the selected _DataNode or 0 if there is none.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 82 of file QmitkDataStorageComboBox.cpp.
References GetNode().
Referenced by OnCurrentIndexChanged(), and QmitkNDIToolDelegate::setModelData().
|
protected |
Checks if the given index is within the range of the m_Nodes vector.
Definition at line 276 of file QmitkDataStorageComboBox.cpp.
References m_Nodes.
Referenced by GetNode(), InsertNode(), RemoveNode(), and SetNode().
|
protected |
Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors.
Definition at line 390 of file QmitkDataStorageComboBox.cpp.
References OnCurrentIndexChanged().
Referenced by QmitkDataStorageComboBox().
|
protectedvirtual |
Inserts a new node at the given index. If the index does not exist, the _DataNode is simply appended to the combobox.
This function is used by AddNode() and SetNode() because they just to the same:
property of the node because this is the only thing we are interested in !!!!!
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 302 of file QmitkDataStorageComboBox.cpp.
References Find(), mitk::DataNode::GetProperty(), mitk::BaseProperty::GetValueAsString(), HasIndex(), m_AutoSelectNewNodes, m_Nodes, m_NodesDeleteObserverTags, m_NodesModifiedObserverTags, m_Predicate, m_PropertyToNode, mitk::New(), OnDataNodeDeleteOrModified(), and RemoveNode().
Referenced by AddNode(), QmitkDataStorageComboBoxWithSelectNone::InsertNode(), QmitkDataStorageComboBoxWithSelectNone::SetNode(), and SetNode().
|
protectedslot |
Slot for signal when the user selects another item.
Definition at line 294 of file QmitkDataStorageComboBox.cpp.
References GetSelectedNode(), and OnSelectionChanged().
Referenced by Init().
|
virtual |
Called when a node is deleted or the name property of the node was modified. Calls RemoveNode or SetNode then.
Definition at line 223 of file QmitkDataStorageComboBox.cpp.
References m_BlockEvents, m_PropertyToNode, RemoveNode(), and SetNode().
Referenced by InsertNode().
|
signal |
Throw a signal when the _DataNode selection changed.
Referenced by OnCurrentIndexChanged().
|
virtual |
Removes a node from the ComboBox at a specified index (if the index exists). Gets called when a DataStorage Remove Event was thrown.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 167 of file QmitkDataStorageComboBox.cpp.
References mitk::DataNode::GetProperty(), HasIndex(), m_Nodes, m_NodesDeleteObserverTags, m_NodesModifiedObserverTags, and m_PropertyToNode.
Referenced by InsertNode(), OnDataNodeDeleteOrModified(), RemoveNode(), Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().
|
virtual |
Removes a node from the ComboBox. Gets called when a DataStorage Remove Event was thrown.
Definition at line 194 of file QmitkDataStorageComboBox.cpp.
References Find(), m_BlockEvents, and RemoveNode().
|
protectedvirtual |
Reset function whenever datastorage or predicate changes.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 395 of file QmitkDataStorageComboBox.cpp.
References AddNode(), mitk::DataStorage::GetAll(), mitk::DataStorage::GetSubset(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, m_Nodes, m_Predicate, and RemoveNode().
Referenced by QmitkDataStorageComboBoxWithSelectNone::Reset(), SetDataStorage(), and SetPredicate().
|
virtual |
Sets AutoSelectNewItems flag. If set to true new Nodes will be automatically selected. Default is false.
Definition at line 218 of file QmitkDataStorageComboBox.cpp.
References m_AutoSelectNewNodes.
void QmitkDataStorageComboBox::SetDataStorage | ( | mitk::DataStorage * | dataStorage | ) |
Set the DataStorage this ComboBox should listen to.
If DataStorage is 0 nothing will be shown. If DataStorage is re-set the combobox will be resetted.
Definition at line 110 of file QmitkDataStorageComboBox.cpp.
References mitk::MessageBase< AbstractDelegate >::AddListener(), AddNode(), mitk::DataStorage::AddNodeEvent, mitk::WeakPointer< TObjectType >::GetPointer(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, mitk::MessageBase< AbstractDelegate >::RemoveListener(), RemoveNode(), mitk::DataStorage::RemoveNodeEvent, and Reset().
Referenced by QmitkToolReferenceDataSelectionBox::Initialize(), and QmitkDataStorageComboBox().
|
virtual |
Set a _DataNode in the ComboBox at the specified index (if the index exists). Internally the method just calls RemoveNode(unsigned int)
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 205 of file QmitkDataStorageComboBox.cpp.
References HasIndex(), and InsertNode().
Referenced by OnDataNodeDeleteOrModified(), and SetNode().
|
virtual |
Replaces a _DataNode in the combobox by an _OtherDataNode. Internally the method just calls SetNode(unsigned int, mitk::DataNode*)
Definition at line 213 of file QmitkDataStorageComboBox.cpp.
void QmitkDataStorageComboBox::SetPredicate | ( | const mitk::NodePredicateBase * | _Predicate | ) |
Set the predicate for this ComboBox. (QmitkDataStorageComboBox is now owner of the predicate)
If predicate is NULL all nodes will be selected. If predicate changes the whole combobox will be resetted.
Definition at line 146 of file QmitkDataStorageComboBox.cpp.
References m_Predicate, and Reset().
Referenced by QmitkToolReferenceDataSelectionBox::UpdateDataDisplay().
|
slot |
Slot for signal when user wants to set a node as current selected node.
Definition at line 262 of file QmitkDataStorageComboBox.cpp.
References Find(), and MITK_INFO.
Referenced by QmitkFunctionalityComponentContainer::ImageSelected().
|
protected |
If set to "true" new Nodes will be automatically selected.
Definition at line 240 of file QmitkDataStorageComboBox.h.
Referenced by GetAutoSelectNewItems(), InsertNode(), and SetAutoSelectNewItems().
|
protected |
Event function guard. Each function which is called by an event mechanism first checks if this is true in order to avoid endless loops.
Definition at line 236 of file QmitkDataStorageComboBox.h.
Referenced by AddNode(), OnDataNodeDeleteOrModified(), and RemoveNode().
|
protected |
Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there might be more than one DataStorage).
Definition at line 204 of file QmitkDataStorageComboBox.h.
Referenced by GetDataStorage(), Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().
|
protected |
Holds all selected Nodes. Dont hold smart pointer as we are in a GUI class.
Definition at line 215 of file QmitkDataStorageComboBox.h.
Referenced by Find(), QmitkDataStorageComboBoxWithSelectNone::GetNode(), GetNode(), GetNodes(), QmitkDataStorageComboBoxWithSelectNone::HasIndex(), HasIndex(), InsertNode(), QmitkDataStorageComboBoxWithSelectNone::RemoveNode(), RemoveNode(), Reset(), QmitkDataStorageComboBoxWithSelectNone::SetNode(), QmitkDataStorageComboBoxWithSelectNone::SetSelectedNode(), and ~QmitkDataStorageComboBox().
|
protected |
Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes)
Definition at line 225 of file QmitkDataStorageComboBox.h.
Referenced by InsertNode(), QmitkDataStorageComboBoxWithSelectNone::RemoveNode(), and RemoveNode().
|
protected |
Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes)
Definition at line 220 of file QmitkDataStorageComboBox.h.
Referenced by InsertNode(), QmitkDataStorageComboBoxWithSelectNone::RemoveNode(), and RemoveNode().
|
protected |
Holds the predicate that is responsible for the _DataNode selection of this ComboBox. If the predicate is 0, every _DataNode will be selected.
Definition at line 210 of file QmitkDataStorageComboBox.h.
Referenced by GetPredicate(), InsertNode(), Reset(), and SetPredicate().
|
protected |
Maps a a specific node to (Name-)property. This is needed because we have to find the assiociated node whenever the name property of a node changed.
Definition at line 231 of file QmitkDataStorageComboBox.h.
Referenced by InsertNode(), OnDataNodeDeleteOrModified(), QmitkDataStorageComboBoxWithSelectNone::RemoveNode(), and RemoveNode().