Medical Imaging Interaction Toolkit  2022.04.99-b2814023
Medical Imaging Interaction Toolkit
QmitkSingleNodeSelectionWidget Class Reference

Widget that represents a node selection of (max) one node. It acts like a button. Clicking on it allows to change the selection. More...

#include <QmitkSingleNodeSelectionWidget.h>

Inheritance diagram for QmitkSingleNodeSelectionWidget:
Collaboration diagram for QmitkSingleNodeSelectionWidget:

Public Types

using NodeList = QmitkAbstractNodeSelectionWidget::NodeList
- Public Types inherited from QmitkAbstractNodeSelectionWidget
using NodeList = QList< mitk::DataNode::Pointer >
using ConstNodeStdVector = std::vector< mitk::DataNode::ConstPointer >

Public Slots

void SetCurrentSelectedNode (mitk::DataNode *selectedNode)
void SetAutoSelectNewNodes (bool autoSelect)
- Public Slots inherited from QmitkAbstractNodeSelectionWidget
void SetSelectOnlyVisibleNodes (bool selectOnlyVisibleNodes)
 Change the selection modus of the item view's selection model. More...
void SetCurrentSelection (NodeList selectedNodes)
 Transform a list of data nodes (a selection) into a model selection and set this as a new selection of the selection model of the private member item view. More...
void SetInvalidInfo (QString info)
void SetEmptyInfo (QString info)
void SetPopUpTitel (QString info)
void SetPopUpHint (QString info)
void SetSelectionIsOptional (bool isOptional)

Public Member Functions

 QmitkSingleNodeSelectionWidget (QWidget *parent=nullptr)
mitk::DataNode::Pointer GetSelectedNode () const
bool GetAutoSelectNewNodes () const
- Public Member Functions inherited from QmitkAbstractNodeSelectionWidget
 QmitkAbstractNodeSelectionWidget (QWidget *parent=nullptr)
virtual ~QmitkAbstractNodeSelectionWidget () override
void SetDataStorage (mitk::DataStorage *dataStorage)
 Sets the data storage that will be used / monitored by widget. More...
void SetNodePredicate (const mitk::NodePredicateBase *nodePredicate)
const mitk::NodePredicateBaseGetNodePredicate () const
QString GetInvalidInfo () const
QString GetEmptyInfo () const
QString GetPopUpTitel () const
QString GetPopUpHint () const
bool GetSelectionIsOptional () const
bool GetSelectOnlyVisibleNodes () const
NodeList GetSelectedNodes () const
ConstNodeStdVector GetSelectedNodesStdVector () const

Protected Slots

virtual void OnClearSelection ()
- Protected Slots inherited from QmitkAbstractNodeSelectionWidget
void RemoveNodeFromSelection (const mitk::DataNode *node)

Protected Member Functions

void ReviseSelectionChanged (const NodeList &oldInternalSelection, NodeList &newInternalSelection) override
bool eventFilter (QObject *obj, QEvent *ev) override
void EditSelection ()
void UpdateInfo () override
void OnDataStorageChanged () override
void OnNodeAddedToStorage (const mitk::DataNode *node) override
void AutoSelectNodes ()
mitk::DataNode::Pointer DetermineAutoSelectNode (const NodeList &ignoreNodes={})
- Protected Member Functions inherited from QmitkAbstractNodeSelectionWidget
virtual void OnNodePredicateChanged ()
virtual void OnInternalSelectionChanged ()
virtual void OnNodeRemovedFromStorage (const mitk::DataNode *node)
void HandleChangeOfInternalSelection (NodeList newInternalSelection)
NodeList CompileEmitSelection () const
virtual bool AllowEmissionOfSelection (const NodeList &emissionCandidates) const
void EmitSelection (const NodeList &emissionCandidates)
void SetCurrentInternalSelection (NodeList selectedNodes)
const NodeListGetCurrentInternalSelection () const
const NodeListGetCurrentExternalSelection () const

Protected Attributes

bool m_AutoSelectNodes
Ui_QmitkSingleNodeSelectionWidget m_Controls
- Protected Attributes inherited from QmitkAbstractNodeSelectionWidget
mitk::WeakPointer< mitk::DataStoragem_DataStorage
mitk::NodePredicateBase::ConstPointer m_NodePredicate
QString m_InvalidInfo
QString m_EmptyInfo
QString m_PopUpTitel
QString m_PopUpHint
bool m_IsOptional
bool m_SelectOnlyVisibleNodes

Additional Inherited Members

- Signals inherited from QmitkAbstractNodeSelectionWidget
void CurrentSelectionChanged (NodeList nodes)
 A signal that will be emitted if the selected node has changed. More...

Detailed Description

Widget that represents a node selection of (max) one node. It acts like a button. Clicking on it allows to change the selection.

This class provides a public function 'SetAutoSelectNewNodes' that can be used to enable the auto selection mode (default is false). The user of this class calling this function has to make sure that the base-class Q_SIGNAL 'CurrentSelectionChanged', which will be emitted by this function, is already connected to a receiving slot, if the initial valid auto selection should not get lost.

Definition at line 40 of file QmitkSingleNodeSelectionWidget.h.

Member Typedef Documentation

◆ NodeList

Constructor & Destructor Documentation

◆ QmitkSingleNodeSelectionWidget()

QmitkSingleNodeSelectionWidget::QmitkSingleNodeSelectionWidget ( QWidget *  parent = nullptr)

Member Function Documentation

◆ AutoSelectNodes()

void QmitkSingleNodeSelectionWidget::AutoSelectNodes ( )

◆ DetermineAutoSelectNode()

mitk::DataNode::Pointer QmitkSingleNodeSelectionWidget::DetermineAutoSelectNode ( const NodeList ignoreNodes = {})

Helper function that gets a suitable auto selected node from the datastorage that fits to the predicate settings.

ignoreNodesYou may pass a list of nodes that must not be choosen as auto selected node.

◆ EditSelection()

void QmitkSingleNodeSelectionWidget::EditSelection ( )

◆ eventFilter()

bool QmitkSingleNodeSelectionWidget::eventFilter ( QObject *  obj,
QEvent *  ev 

◆ GetAutoSelectNewNodes()

bool QmitkSingleNodeSelectionWidget::GetAutoSelectNewNodes ( ) const

◆ GetSelectedNode()

mitk::DataNode::Pointer QmitkSingleNodeSelectionWidget::GetSelectedNode ( ) const

◆ OnClearSelection

virtual void QmitkSingleNodeSelectionWidget::OnClearSelection ( )

◆ OnDataStorageChanged()

void QmitkSingleNodeSelectionWidget::OnDataStorageChanged ( )

Method is called if the data storage has changed. The selection will be automatically be reseted afterwards. The default implementation does nothing.

Reimplemented from QmitkAbstractNodeSelectionWidget.

◆ OnNodeAddedToStorage()

void QmitkSingleNodeSelectionWidget::OnNodeAddedToStorage ( const mitk::DataNode node)

Method is called when a node is added to the storage. Default implementation does nothing. Derived widgets can override the method if they want to react on new nodes in the storage.

Reimplemented from QmitkAbstractNodeSelectionWidget.

◆ ReviseSelectionChanged()

void QmitkSingleNodeSelectionWidget::ReviseSelectionChanged ( const NodeList oldInternalSelection,
NodeList newInternalSelection 

This member function is called if the internal selection is about to be changed by the base implementation. This is the slot where derived classes can revise and change the internal selection before widget updates, signal emissions and other things are triggered. Default implementation does nothing, thus it keeps the passed internal selection as compiled by the base implementation.

Reimplemented from QmitkAbstractNodeSelectionWidget.

◆ SetAutoSelectNewNodes

void QmitkSingleNodeSelectionWidget::SetAutoSelectNewNodes ( bool  autoSelect)

Sets the auto selection mode (default is false). If auto select is true and the following conditions are fullfilled, the widget will select a node automatically from the data storage:

  • a data storage is set
  • data storage contains at least one node that matches the given predicate
  • no selection is set
Enabling the auto selection mode by calling 'SetAutoSelectNewNodes(true)' will directly emit a 'QmitkSingleNodeSelectionWidget::CurrentSelectionChanged' Q_SIGNAL if a valid auto selection was made. If this initial emission should not get lost, auto selection mode needs to be enabled after this selection widget has been connected via the 'QmitkSingleNodeSelectionWidget::CurrentSelectionChanged' Q_SIGNAL to a receiving function.

◆ SetCurrentSelectedNode

void QmitkSingleNodeSelectionWidget::SetCurrentSelectedNode ( mitk::DataNode selectedNode)

◆ UpdateInfo()

void QmitkSingleNodeSelectionWidget::UpdateInfo ( )

Method is called if the display of the selected nodes should be updated (e.g. because the selection changed).

Implements QmitkAbstractNodeSelectionWidget.

Member Data Documentation

◆ m_AutoSelectNodes

bool QmitkSingleNodeSelectionWidget::m_AutoSelectNodes

See documentation of SetAutoSelectNewNodes for details

Definition at line 92 of file QmitkSingleNodeSelectionWidget.h.

◆ m_Controls

Ui_QmitkSingleNodeSelectionWidget QmitkSingleNodeSelectionWidget::m_Controls

Definition at line 94 of file QmitkSingleNodeSelectionWidget.h.

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