Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
QmitkDataStorageComboBox Class Reference

Displays all or a subset (defined by a predicate) of nodes of the Data Storage. More...

#include <QmitkDataStorageComboBox.h>

Inheritance diagram for QmitkDataStorageComboBox:
Collaboration diagram for QmitkDataStorageComboBox:

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

Author
Michael Mueller
Version
4.0
Date
2009-02-09

Definition at line 38 of file QmitkDataStorageComboBox.h.

Constructor & Destructor Documentation

◆ QmitkDataStorageComboBox() [1/2]

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

Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards.

◆ QmitkDataStorageComboBox() [2/2]

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.

◆ ~QmitkDataStorageComboBox()

QmitkDataStorageComboBox::~QmitkDataStorageComboBox ( )
override

Standard Dtor. Nothing to do here.

Member Function Documentation

◆ AddNode()

virtual void QmitkDataStorageComboBox::AddNode ( const mitk::DataNode dataNode)
virtual

Adds a node to the ComboBox. Gets called every time a DataStorage Add Event was thrown.

◆ Find()

virtual int QmitkDataStorageComboBox::Find ( const mitk::DataNode dataNode) const
virtual

Searches for a given node and returns a valid index or -1 if the node was not found.

Reimplemented in QmitkDataStorageComboBoxWithSelectNone.

◆ GetAutoSelectNewItems()

virtual bool QmitkDataStorageComboBox::GetAutoSelectNewItems ( )
virtual

Returns the AutoSelectNewItems.

See also
SetAutoSelectNewItems

◆ GetDataStorage()

mitk::DataStorage::Pointer QmitkDataStorageComboBox::GetDataStorage ( ) const

Get the DataStorage this ComboBox listens to.

◆ GetNode()

virtual mitk::DataNode::Pointer QmitkDataStorageComboBox::GetNode ( int  index) const
virtual

Returns the dataNode at Index index or 0 if the index is out of bounds.

Reimplemented in QmitkDataStorageComboBoxWithSelectNone.

◆ GetNodes()

mitk::DataStorage::SetOfObjects::ConstPointer QmitkDataStorageComboBox::GetNodes ( ) const

Returns all nodes that are stored in this combobox.

◆ GetPredicate()

const mitk::NodePredicateBase::ConstPointer QmitkDataStorageComboBox::GetPredicate ( ) const

Return the predicate (may be nullptr) that is responsible for the dataNode selection of this ComboBox.

◆ GetSelectedNode()

virtual mitk::DataNode::Pointer QmitkDataStorageComboBox::GetSelectedNode ( ) const
virtual

Returns the selected dataNode or 0 if there is none.

Reimplemented in QmitkDataStorageComboBoxWithSelectNone.

◆ HasIndex()

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

Checks if the given index is within the range of the m_Nodes vector.

◆ Init()

void QmitkDataStorageComboBox::Init ( )
protected

Init-function this class with the given data storage and predicate. This function is called by all ctors.

◆ InsertNode()

virtual void QmitkDataStorageComboBox::InsertNode ( int  index,
const mitk::DataNode dataNode 
)
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:

  1. If node is replaced (that is when index exists), the itk::Event observer will be removed
  2. Check Node against Predicate
  3. Register for itk::Events on the node
  4. Insert Node and show in combobox

Reimplemented in QmitkDataStorageComboBoxWithSelectNone.

◆ OnCurrentIndexChanged

void QmitkDataStorageComboBox::OnCurrentIndexChanged ( int  )
protectedslot

Slot for signal when the user selects another item.

◆ OnPropertyListChanged()

virtual void QmitkDataStorageComboBox::OnPropertyListChanged ( const itk::Object *  caller,
const itk::EventObject &  event 
)
virtual

Called when the name property of the node was modified.

◆ OnSelectionChanged

void QmitkDataStorageComboBox::OnSelectionChanged ( const mitk::DataNode )
signal

Throw a signal when the data node selection changed.

◆ RemoveNode() [1/2]

virtual void QmitkDataStorageComboBox::RemoveNode ( const mitk::DataNode dataNode)
virtual

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

◆ RemoveNode() [2/2]

virtual void QmitkDataStorageComboBox::RemoveNode ( int  index)
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.

◆ RemoveNodeAndPropertyLists()

void QmitkDataStorageComboBox::RemoveNodeAndPropertyLists ( int  index)
protected

◆ Reset()

virtual void QmitkDataStorageComboBox::Reset ( )
protectedvirtual

Reset function whenever data storage or predicate changes.

Reimplemented in QmitkDataStorageComboBoxWithSelectNone.

◆ SetAutoSelectNewItems()

virtual void QmitkDataStorageComboBox::SetAutoSelectNewItems ( bool  autoSelectNewItems)
virtual

Sets AutoSelectNewItems flag. If set to true new Nodes will be automatically selected. Default is false.

◆ SetDataStorage()

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.

◆ SetNode() [1/2]

virtual void QmitkDataStorageComboBox::SetNode ( const mitk::DataNode dataNode,
const mitk::DataNode otherDataNode 
)
virtual

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

◆ SetNode() [2/2]

virtual void QmitkDataStorageComboBox::SetNode ( int  index,
const mitk::DataNode dataNode 
)
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.

◆ SetPredicate()

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.

◆ SetSelectedNode

void QmitkDataStorageComboBox::SetSelectedNode ( const mitk::DataNode::Pointer node)
slot

Slot for signal when user wants to set a node as current selected node.

◆ UpdateComboBoxText()

virtual void QmitkDataStorageComboBox::UpdateComboBoxText ( const mitk::PropertyList )
protectedvirtual

Member Data Documentation

◆ m_AutoSelectNewNodes

bool QmitkDataStorageComboBox::m_AutoSelectNewNodes
protected

If set to "true" new Nodes will be automatically selected.

Definition at line 222 of file QmitkDataStorageComboBox.h.

◆ m_BaseDatapropertyListObserverTags

std::vector<long> QmitkDataStorageComboBox::m_BaseDatapropertyListObserverTags
protected

Holds the tags of the base data property observers.

Definition at line 213 of file QmitkDataStorageComboBox.h.

◆ m_BlockEvents

bool QmitkDataStorageComboBox::m_BlockEvents
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.

◆ m_DataNodePropertyListObserverTags

std::vector<long> QmitkDataStorageComboBox::m_DataNodePropertyListObserverTags
protected

Holds the tags of the data node property observers.

Definition at line 208 of file QmitkDataStorageComboBox.h.

◆ m_DataStorage

mitk::WeakPointer<mitk::DataStorage> QmitkDataStorageComboBox::m_DataStorage
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.

◆ m_Nodes

std::vector<mitk::DataNode *> QmitkDataStorageComboBox::m_Nodes
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.

◆ m_Predicate

mitk::NodePredicateBase::ConstPointer QmitkDataStorageComboBox::m_Predicate
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.


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