Medical Imaging Interaction Toolkit
2018.4.99-389bf124
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 (const mitk::DataNode::Pointer &node) |
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 data node 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 () override | |
Standard Dtor. Nothing to do here. More... | |
virtual int | Find (const mitk::DataNode *dataNode) const |
Searches 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 nullptr) 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 | OnPropertyListChanged (const itk::Object *caller, const itk::EventObject &event) |
Called when the name property of the node was modified. 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 data node is simply appended to the combobox. More... | |
void | Init () |
Init-function this class with the given data storage and predicate. This function is called by all ctors. More... | |
virtual void | Reset () |
Reset function whenever data storage or predicate changes. More... | |
void | RemoveNodeAndPropertyLists (int index) |
virtual void | UpdateComboBoxText (const mitk::PropertyList *) |
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_DataNodePropertyListObserverTags |
Holds the tags of the data node property observers. More... | |
std::vector< long > | m_BaseDatapropertyListObserverTags |
Holds the tags of the base data property observers. 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.
Definition at line 38 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 17 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 27 of file QmitkDataStorageComboBox.cpp.
References Init(), and SetDataStorage().
|
override |
Standard Dtor. Nothing to do here.
Definition at line 42 of file QmitkDataStorageComboBox.cpp.
References AddNode(), mitk::WeakPointer< T >::IsExpired(), mitk::WeakPointer< T >::Lock(), m_DataStorage, m_Nodes, and RemoveNode().
|
virtual |
Adds a node to the ComboBox. Gets called every time a DataStorage Add Event was thrown.
Definition at line 165 of file QmitkDataStorageComboBox.cpp.
References InsertNode(), and m_BlockEvents.
Referenced by Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().
|
virtual |
Searches for a given node and returns a valid index or -1 if the node was not found.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 62 of file QmitkDataStorageComboBox.cpp.
References m_Nodes.
Referenced by QmitkDataStorageComboBoxWithSelectNone::Find(), InsertNode(), RemoveNode(), QmitkInitialValuesDelegate::setEditorData(), SetNode(), SetSelectedNode(), and UpdateComboBoxText().
|
virtual |
Returns the AutoSelectNewItems.
Definition at line 111 of file QmitkDataStorageComboBox.cpp.
References m_AutoSelectNewNodes.
mitk::DataStorage::Pointer QmitkDataStorageComboBox::GetDataStorage | ( | ) | const |
Get the DataStorage this ComboBox listens to.
Definition at line 74 of file QmitkDataStorageComboBox.cpp.
References mitk::WeakPointer< T >::Lock(), 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 84 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 99 of file QmitkDataStorageComboBox.cpp.
References m_Nodes.
const mitk::NodePredicateBase::ConstPointer QmitkDataStorageComboBox::GetPredicate | ( | ) | const |
Return the predicate (may be nullptr) that is responsible for the dataNode selection of this ComboBox.
Definition at line 79 of file QmitkDataStorageComboBox.cpp.
References m_Predicate.
|
virtual |
Returns the selected dataNode or 0 if there is none.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 89 of file QmitkDataStorageComboBox.cpp.
References GetNode().
Referenced by OnCurrentIndexChanged(), QmitkInitialValuesDelegate::setModelData(), and QmitkNDIToolDelegate::setModelData().
|
protected |
Checks if the given index is within the range of the m_Nodes vector.
Definition at line 242 of file QmitkDataStorageComboBox.cpp.
References m_Nodes.
Referenced by GetNode(), InsertNode(), RemoveNode(), and SetNode().
|
protected |
Init-function this class with the given data storage and predicate. This function is called by all ctors.
Definition at line 368 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 data node is simply appended to the combobox.
This function is used by AddNode() and SetNode() because they just to the same:
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 268 of file QmitkDataStorageComboBox.cpp.
References Find(), mitk::DataNode::GetData(), mitk::DataNode::GetName(), mitk::DataNode::GetPropertyList(), mitk::BaseData::GetPropertyList(), HasIndex(), m_AutoSelectNewNodes, m_BaseDatapropertyListObserverTags, m_DataNodePropertyListObserverTags, m_Nodes, m_Predicate, OnPropertyListChanged(), and RemoveNode().
Referenced by AddNode(), QmitkDataStorageComboBoxWithSelectNone::InsertNode(), QmitkDataStorageComboBoxWithSelectNone::SetNode(), and SetNode().
|
protectedslot |
Slot for signal when the user selects another item.
Definition at line 247 of file QmitkDataStorageComboBox.cpp.
References GetSelectedNode(), and OnSelectionChanged().
Referenced by Init().
|
virtual |
Called when the name property of the node was modified.
Definition at line 224 of file QmitkDataStorageComboBox.cpp.
References m_BlockEvents, and UpdateComboBoxText().
Referenced by InsertNode().
|
signal |
Throw a signal when the data node selection changed.
Referenced by OnCurrentIndexChanged(), and QmitkNodeDetailsDialog::QmitkNodeDetailsDialog().
|
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 177 of file QmitkDataStorageComboBox.cpp.
References HasIndex(), and RemoveNodeAndPropertyLists().
Referenced by InsertNode(), RemoveNode(), Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().
|
virtual |
Removes a node from the ComboBox. Gets called when a DataStorage Remove Event was thrown.
Definition at line 187 of file QmitkDataStorageComboBox.cpp.
References Find(), m_BlockEvents, and RemoveNode().
|
protected |
Definition at line 409 of file QmitkDataStorageComboBox.cpp.
References mitk::DataNode::GetData(), mitk::DataNode::GetPropertyList(), mitk::BaseData::GetPropertyList(), m_BaseDatapropertyListObserverTags, m_DataNodePropertyListObserverTags, and m_Nodes.
Referenced by QmitkDataStorageComboBoxWithSelectNone::RemoveNode(), and RemoveNode().
|
protectedvirtual |
Reset function whenever data storage or predicate changes.
Reimplemented in QmitkDataStorageComboBoxWithSelectNone.
Definition at line 373 of file QmitkDataStorageComboBox.cpp.
References AddNode(), mitk::WeakPointer< T >::IsExpired(), mitk::WeakPointer< T >::Lock(), 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 219 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 reset the combobox will be reset.
Definition at line 116 of file QmitkDataStorageComboBox.cpp.
References AddNode(), mitk::WeakPointer< T >::IsExpired(), mitk::WeakPointer< T >::Lock(), m_DataStorage, RemoveNode(), 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 198 of file QmitkDataStorageComboBox.cpp.
References mitk::DataNode::GetName(), HasIndex(), InsertNode(), and m_Nodes.
Referenced by SetNode().
|
virtual |
Replaces a dataNode in the combobox by an otherDataNode. Internally the method just calls SetNode(unsigned int, mitk::DataNode*)
Definition at line 214 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 nullptr all nodes will be selected. If predicate changes the whole combobox will be reset.
Definition at line 156 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 255 of file QmitkDataStorageComboBox.cpp.
|
protectedvirtual |
Definition at line 440 of file QmitkDataStorageComboBox.cpp.
References Find(), mitk::BaseData::GetPropertyList(), and m_Nodes.
Referenced by OnPropertyListChanged().
|
protected |
If set to "true" new Nodes will be automatically selected.
Definition at line 222 of file QmitkDataStorageComboBox.h.
Referenced by GetAutoSelectNewItems(), InsertNode(), and SetAutoSelectNewItems().
|
protected |
Holds the tags of the base data property observers.
Definition at line 213 of file QmitkDataStorageComboBox.h.
Referenced by InsertNode(), and RemoveNodeAndPropertyLists().
|
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 218 of file QmitkDataStorageComboBox.h.
Referenced by AddNode(), OnPropertyListChanged(), and RemoveNode().
|
protected |
Holds the tags of the data node property observers.
Definition at line 208 of file QmitkDataStorageComboBox.h.
Referenced by InsertNode(), and RemoveNodeAndPropertyLists().
|
protected |
Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there might be more than one DataStorage).
Definition at line 192 of file QmitkDataStorageComboBox.h.
Referenced by GetDataStorage(), Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().
|
protected |
Holds all selected Nodes. Don't hold smart pointer as we are in a GUI class.
Definition at line 203 of file QmitkDataStorageComboBox.h.
Referenced by Find(), GetNode(), QmitkDataStorageComboBoxWithSelectNone::GetNode(), GetNodes(), QmitkDataStorageComboBoxWithSelectNone::HasIndex(), HasIndex(), InsertNode(), RemoveNodeAndPropertyLists(), Reset(), QmitkDataStorageComboBoxWithSelectNone::SetNode(), SetNode(), UpdateComboBoxText(), and ~QmitkDataStorageComboBox().
|
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 198 of file QmitkDataStorageComboBox.h.
Referenced by GetPredicate(), InsertNode(), Reset(), and SetPredicate().