Medical Imaging Interaction Toolkit  2022.10.99-92cc8b65
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 nullptr 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 () override
 Nothing to do. More...
 
int Find (const mitk::DataNode *dataNode) const override
 Searches for a given node, returning the index if found. More...
 
mitk::DataNode::Pointer GetNode (int index) const override
 Retrieves the node at a given index, where if index is zero, will always return nullptr. More...
 
mitk::DataNode::Pointer GetSelectedNode () const override
 Returns the selected DataNode or nullptr 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...
 
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...
 
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...
 
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)
 
- 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 () override
 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 nullptr) 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 OnPropertyListChanged (const itk::Object *caller, const itk::EventObject &event)
 Called when the name property of the node was modified. 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...
 
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...
 
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 data storage and predicate. This function is called by all ctors. More...
 
void RemoveNodeAndPropertyLists (int index)
 
virtual void UpdateComboBoxText (const mitk::PropertyList *)
 

Properties

mitkDataNodePtr SelectedNode
 
QString currentValue
 

Additional Inherited Members

- Public Slots inherited from QmitkDataStorageComboBox
void SetSelectedNode (const mitk::DataNode::Pointer &node)
 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 data node 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_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...
 

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 nullptr 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 33 of file QmitkDataStorageComboBoxWithSelectNone.h.

Constructor & Destructor Documentation

◆ QmitkDataStorageComboBoxWithSelectNone() [1/2]

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

Calls base class constructor.

See also
QmitkDataStorageComboBox

◆ QmitkDataStorageComboBoxWithSelectNone() [2/2]

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

Calls base class constructor.

See also
QmitkDataStorageComboBox

◆ ~QmitkDataStorageComboBoxWithSelectNone()

QmitkDataStorageComboBoxWithSelectNone::~QmitkDataStorageComboBoxWithSelectNone ( )
override

Nothing to do.

See also
QmitkDataStorageComboBox

Member Function Documentation

◆ currentValue()

virtual QString QmitkDataStorageComboBoxWithSelectNone::currentValue ( ) const
virtual

Get the current file path.

◆ Find()

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 nullptr.
Returns
int -1 if not found, and compared to base class, will add 1 onto the retrieved index.

Reimplemented from QmitkDataStorageComboBox.

◆ GetNode()

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

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

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

Reimplemented from QmitkDataStorageComboBox.

◆ GetSelectedNode()

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

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

Reimplemented from QmitkDataStorageComboBox.

◆ HasIndex()

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

Checks if the given index is within range.

◆ InsertNode()

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.

◆ RemoveNode() [1/3]

virtual void QmitkDataStorageComboBox::RemoveNode

Removes a node from the ComboBox. Gets called when a DataStorage Remove Event was thrown.

◆ RemoveNode() [2/3]

virtual void QmitkDataStorageComboBox::RemoveNode

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

◆ RemoveNode() [3/3]

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.

◆ Reset()

void QmitkDataStorageComboBoxWithSelectNone::Reset ( )
overrideprotectedvirtual

Reset function whenever datastorage or predicate changes.

Reimplemented from QmitkDataStorageComboBox.

◆ setCurrentValue()

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

Set the current file path.

◆ SetNode() [1/3]

virtual void QmitkDataStorageComboBox::SetNode

Replaces a dataNode in the combobox by an otherDataNode. Internally the method just calls SetNode(unsigned int, mitk::DataNode*)

◆ SetNode() [2/3]

virtual void QmitkDataStorageComboBox::SetNode

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

◆ SetNode() [3/3]

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.

◆ SetSelectedNode()

virtual 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.

◆ SetZeroEntryText()

void QmitkDataStorageComboBoxWithSelectNone::SetZeroEntryText ( const QString &  zeroEntryString)

Set the string that will be present on index 0.

Member Data Documentation

◆ ZERO_ENTRY_STRING

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 65 of file QmitkDataStorageComboBoxWithSelectNone.h.

Property Documentation

◆ currentValue

QString QmitkDataStorageComboBoxWithSelectNone::currentValue
readwrite

Definition at line 38 of file QmitkDataStorageComboBoxWithSelectNone.h.

◆ SelectedNode

mitkDataNodePtr QmitkDataStorageComboBoxWithSelectNone::SelectedNode
readwrite

Definition at line 37 of file QmitkDataStorageComboBoxWithSelectNone.h.


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