Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkDataStorageComboBoxWithSelectNone Class Reference

Displays all or a subset (defined by a predicate) of nodes of the Data Storage, and additionally, index 0 is always "please select", indicating no selection, and will hence always return a NULL mitk::DataNode* if asked for the node at index 0. More...

#include <QmitkDataStorageComboBoxWithSelectNone.h>

Inheritance diagram for QmitkDataStorageComboBoxWithSelectNone:
Collaboration diagram for QmitkDataStorageComboBoxWithSelectNone:

Public Member Functions

 QmitkDataStorageComboBoxWithSelectNone (QWidget *parent=nullptr, bool autoSelectNewNodes=false)
 Calls base class constructor. More...
 
 QmitkDataStorageComboBoxWithSelectNone (mitk::DataStorage *_DataStorage, const mitk::NodePredicateBase *predicate, QWidget *parent=nullptr, bool autoSelectNewNodes=false)
 Calls base class constructor. More...
 
 ~QmitkDataStorageComboBoxWithSelectNone ()
 Nothing to do. More...
 
virtual int Find (const mitk::DataNode *dataNode) const override
 Searches for a given node, returning the index if found. More...
 
virtual mitk::DataNode::Pointer GetNode (int index) const override
 Retrieves the node at a given index, where if index is zero, will always return NULL. More...
 
virtual mitk::DataNode::Pointer GetSelectedNode () const override
 Returns the selected DataNode or NULL if there is none, or the current index is zero. More...
 
virtual void SetSelectedNode (const mitk::DataNode::Pointer &node)
 Sets the combo box to the index that contains the specified node, or 0 if the node cannot be found. More...
 
virtual void RemoveNode (int index) override
 Removes a node from the ComboBox at a specified index (if the index exists). Gets called when a DataStorage Remove Event was thrown. More...
 
virtual void SetNode (int index, const mitk::DataNode *dataNode) override
 Set a DataNode in the ComboBox at the specified index (if the index exists). Internally the method just calls InsertNode(unsigned int) More...
 
virtual QString currentValue () const
 Get the current file path. More...
 
virtual void setCurrentValue (const QString &path)
 Set the current file path. More...
 
void SetZeroEntryText (const QString &zeroEntryString)
 Set the string that will be present on index 0. More...
 
- Public Member Functions inherited from QmitkDataStorageComboBox
 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...
 
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...
 
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 (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...
 

Static Public Attributes

static const QString ZERO_ENTRY_STRING
 Stores the string that will be present on index 0, currently equal to "please select". More...
 

Protected Member Functions

bool HasIndex (unsigned int index) const
 Checks if the given index is within range. More...
 
virtual void InsertNode (int index, const mitk::DataNode *dataNode) override
 Inserts a new node at the given index, unless index is 0, which is silently ignored. More...
 
virtual void Reset () override
 Reset function whenever datastorage or predicate changes. More...
 
- Protected Member Functions inherited from QmitkDataStorageComboBox
bool HasIndex (unsigned int index) const
 Checks if the given index is within the range of the m_Nodes vector. More...
 
void Init ()
 Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors. More...
 

Properties

mitkDataNodePtr SelectedNode
 
QString currentValue
 

Additional Inherited Members

- Public Slots inherited from QmitkDataStorageComboBox
void SetSelectedNode (mitk::DataNode::Pointer item)
 Slot for signal when user wants to set a node as current selected node. More...
 
- Signals inherited from QmitkDataStorageComboBox
void OnSelectionChanged (const mitk::DataNode *)
 Throw a signal when the _DataNode selection changed. More...
 
- Protected Slots inherited from QmitkDataStorageComboBox
void OnCurrentIndexChanged (int)
 Slot for signal when the user selects another item. More...
 
- Protected Attributes inherited from QmitkDataStorageComboBox
mitk::WeakPointer< mitk::DataStoragem_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...
 

Detailed Description

Displays all or a subset (defined by a predicate) of nodes of the Data Storage, and additionally, index 0 is always "please select", indicating no selection, and will hence always return a NULL mitk::DataNode* if asked for the node at index 0.

Author
Matt Clarkson (m.cla.nosp@m.rkso.nosp@m.n@ucl.nosp@m..ac..nosp@m.uk)
See also
QmitkDataStorageComboBox

Definition at line 36 of file QmitkDataStorageComboBoxWithSelectNone.h.

Constructor & Destructor Documentation

QmitkDataStorageComboBoxWithSelectNone::QmitkDataStorageComboBoxWithSelectNone ( QWidget *  parent = nullptr,
bool  autoSelectNewNodes = false 
)

Calls base class constructor.

See also
QmitkDataStorageComboBox

Definition at line 22 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

QmitkDataStorageComboBoxWithSelectNone::QmitkDataStorageComboBoxWithSelectNone ( mitk::DataStorage _DataStorage,
const mitk::NodePredicateBase predicate,
QWidget *  parent = nullptr,
bool  autoSelectNewNodes = false 
)

Calls base class constructor.

See also
QmitkDataStorageComboBox

Definition at line 32 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

QmitkDataStorageComboBoxWithSelectNone::~QmitkDataStorageComboBoxWithSelectNone ( )

Nothing to do.

See also
QmitkDataStorageComboBox

Definition at line 42 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

Member Function Documentation

virtual QString QmitkDataStorageComboBoxWithSelectNone::currentValue ( ) const
virtual

Get the current file path.

int QmitkDataStorageComboBoxWithSelectNone::Find ( const mitk::DataNode dataNode) const
overridevirtual

Searches for a given node, returning the index if found.

Parameters
dataNodean mitk::DataNode, can be NULL.
Returns
int -1 if not found, and compared to base class, will add 1 onto the retrieved index.

Reimplemented from QmitkDataStorageComboBox.

Definition at line 48 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References QmitkDataStorageComboBox::Find().

mitk::DataNode::Pointer QmitkDataStorageComboBoxWithSelectNone::GetNode ( int  index) const
overridevirtual

Retrieves the node at a given index, where if index is zero, will always return NULL.

Parameters
indexAn integer between 0 and n = number of nodes.
Returns
mitk::DataNode::Pointer NULL or a data node pointer.

Reimplemented from QmitkDataStorageComboBox.

Definition at line 60 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References HasIndex(), and QmitkDataStorageComboBox::m_Nodes.

Referenced by GetSelectedNode().

mitk::DataNode::Pointer QmitkDataStorageComboBoxWithSelectNone::GetSelectedNode ( ) const
overridevirtual

Returns the selected DataNode or NULL if there is none, or the current index is zero.

Reimplemented from QmitkDataStorageComboBox.

Definition at line 76 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References GetNode().

bool QmitkDataStorageComboBoxWithSelectNone::HasIndex ( unsigned int  index) const
protected

Checks if the given index is within range.

Definition at line 163 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References QmitkDataStorageComboBox::m_Nodes.

Referenced by GetNode(), RemoveNode(), and SetNode().

void QmitkDataStorageComboBoxWithSelectNone::InsertNode ( int  index,
const mitk::DataNode dataNode 
)
overrideprotectedvirtual

Inserts a new node at the given index, unless index is 0, which is silently ignored.

Reimplemented from QmitkDataStorageComboBox.

Definition at line 170 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References QmitkDataStorageComboBox::InsertNode().

void QmitkDataStorageComboBoxWithSelectNone::RemoveNode ( int  index)
overridevirtual

Removes a node from the ComboBox at a specified index (if the index exists). Gets called when a DataStorage Remove Event was thrown.

Reimplemented from QmitkDataStorageComboBox.

Definition at line 107 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References mitk::DataNode::GetProperty(), HasIndex(), QmitkDataStorageComboBox::m_Nodes, QmitkDataStorageComboBox::m_NodesDeleteObserverTags, QmitkDataStorageComboBox::m_NodesModifiedObserverTags, and QmitkDataStorageComboBox::m_PropertyToNode.

void QmitkDataStorageComboBoxWithSelectNone::Reset ( void  )
overrideprotectedvirtual

Reset function whenever datastorage or predicate changes.

Reimplemented from QmitkDataStorageComboBox.

Definition at line 180 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References QmitkDataStorageComboBox::Reset(), and ZERO_ENTRY_STRING.

void QmitkDataStorageComboBoxWithSelectNone::setCurrentValue ( const QString &  path)
virtual

Set the current file path.

Definition at line 202 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

void QmitkDataStorageComboBoxWithSelectNone::SetNode ( int  index,
const mitk::DataNode dataNode 
)
overridevirtual

Set a DataNode in the ComboBox at the specified index (if the index exists). Internally the method just calls InsertNode(unsigned int)

Reimplemented from QmitkDataStorageComboBox.

Definition at line 144 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References mitk::DataNode::GetProperty(), mitk::BaseProperty::GetValueAsString(), HasIndex(), QmitkDataStorageComboBox::InsertNode(), and QmitkDataStorageComboBox::m_Nodes.

void QmitkDataStorageComboBoxWithSelectNone::SetSelectedNode ( const mitk::DataNode::Pointer node)
virtual

Sets the combo box to the index that contains the specified node, or 0 if the node cannot be found.

Definition at line 83 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

References QmitkDataStorageComboBox::m_Nodes.

void QmitkDataStorageComboBoxWithSelectNone::SetZeroEntryText ( const QString &  zeroEntryString)

Set the string that will be present on index 0.

Definition at line 188 of file QmitkDataStorageComboBoxWithSelectNone.cpp.

Member Data Documentation

const QString QmitkDataStorageComboBoxWithSelectNone::ZERO_ENTRY_STRING
static

Stores the string that will be present on index 0, currently equal to "please select".

Definition at line 68 of file QmitkDataStorageComboBoxWithSelectNone.h.

Referenced by Reset().

Property Documentation

QString QmitkDataStorageComboBoxWithSelectNone::currentValue
readwrite

Definition at line 41 of file QmitkDataStorageComboBoxWithSelectNone.h.

mitkDataNodePtr QmitkDataStorageComboBoxWithSelectNone::SelectedNode
readwrite

Definition at line 40 of file QmitkDataStorageComboBoxWithSelectNone.h.


The documentation for this class was generated from the following files: