Abstract base class for the selection of data from a data storage.
More...
#include <QmitkAbstractNodeSelectionWidget.h>
Abstract base class for the selection of data from a data storage.
Definition at line 31 of file QmitkAbstractNodeSelectionWidget.h.
◆ ConstNodeStdVector
◆ NodeList
◆ QmitkAbstractNodeSelectionWidget()
QmitkAbstractNodeSelectionWidget::QmitkAbstractNodeSelectionWidget |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
◆ ~QmitkAbstractNodeSelectionWidget()
virtual QmitkAbstractNodeSelectionWidget::~QmitkAbstractNodeSelectionWidget |
( |
| ) |
|
|
overridevirtual |
◆ AllowEmissionOfSelection()
virtual bool QmitkAbstractNodeSelectionWidget::AllowEmissionOfSelection |
( |
const NodeList & |
emissionCandidates | ) |
const |
|
protectedvirtual |
This function will be called before the CurrentSelectionChanged signal is emitted. The return value indicates if the signal should be emitted (true = emission; false = no emission). The default implementation always returns true.
- Parameters
-
emissionCandidates | The nodes that will be emitted if the function returns true. |
Reimplemented in QmitkSynchronizedNodeSelectionWidget, and QmitkMultiNodeSelectionWidget.
◆ CompileEmitSelection()
NodeList QmitkAbstractNodeSelectionWidget::CompileEmitSelection |
( |
| ) |
const |
|
protected |
Compiles the list of node that would be emitted. It always contains the internal selection. Depending on SelectOnlyVisibleNodes it also adds all external select nodes that weren't visible (failed the predicate).
◆ CurrentSelectionChanged
void QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged |
( |
NodeList |
nodes | ) |
|
|
signal |
A signal that will be emitted if the selected node has changed.
- nodes A list of data nodes that are newly selected.
◆ EmitSelection()
void QmitkAbstractNodeSelectionWidget::EmitSelection |
( |
const NodeList & |
emissionCandidates | ) |
|
|
protected |
Checks if the new emission differs from the last emission. If this is the case and AllowEmissionOfSelection() returns true the new selection will be emitted.
◆ GetCurrentExternalSelection()
const NodeList& QmitkAbstractNodeSelectionWidget::GetCurrentExternalSelection |
( |
| ) |
const |
|
protected |
◆ GetCurrentInternalSelection()
const NodeList& QmitkAbstractNodeSelectionWidget::GetCurrentInternalSelection |
( |
| ) |
const |
|
protected |
◆ GetEmptyInfo()
QString QmitkAbstractNodeSelectionWidget::GetEmptyInfo |
( |
| ) |
const |
◆ GetInvalidInfo()
QString QmitkAbstractNodeSelectionWidget::GetInvalidInfo |
( |
| ) |
const |
◆ GetNodePredicate()
◆ GetPopUpHint()
QString QmitkAbstractNodeSelectionWidget::GetPopUpHint |
( |
| ) |
const |
◆ GetPopUpTitel()
QString QmitkAbstractNodeSelectionWidget::GetPopUpTitel |
( |
| ) |
const |
◆ GetSelectedNodes()
NodeList QmitkAbstractNodeSelectionWidget::GetSelectedNodes |
( |
| ) |
const |
Returns the selected nodes, as emitted with CurrentSelectionChanged
◆ GetSelectedNodesStdVector()
Convenience method that returns the selected nodes as ConstNodeStdVector. This is a type also often used in the mitk code base.
◆ GetSelectionIsOptional()
bool QmitkAbstractNodeSelectionWidget::GetSelectionIsOptional |
( |
| ) |
const |
◆ GetSelectOnlyVisibleNodes()
bool QmitkAbstractNodeSelectionWidget::GetSelectOnlyVisibleNodes |
( |
| ) |
const |
◆ HandleChangeOfInternalSelection()
void QmitkAbstractNodeSelectionWidget::HandleChangeOfInternalSelection |
( |
NodeList |
newInternalSelection | ) |
|
|
protected |
Method is called if the internal selection has changed. It will call following methods, that can be overridden to change behavior in derived classes:
◆ OnDataStorageChanged()
virtual void QmitkAbstractNodeSelectionWidget::OnDataStorageChanged |
( |
| ) |
|
|
protectedvirtual |
◆ OnInternalSelectionChanged()
virtual void QmitkAbstractNodeSelectionWidget::OnInternalSelectionChanged |
( |
| ) |
|
|
protectedvirtual |
◆ OnNodeAddedToStorage()
virtual void QmitkAbstractNodeSelectionWidget::OnNodeAddedToStorage |
( |
const mitk::DataNode * |
node | ) |
|
|
protectedvirtual |
◆ OnNodeModified()
virtual void QmitkAbstractNodeSelectionWidget::OnNodeModified |
( |
const itk::Object * |
caller, |
|
|
const itk::EventObject & |
event |
|
) |
| |
|
protectedvirtual |
Method is called when a node is modified. The modified node is passed as 'caller' variable. Default implementation handles changes that are related to the node predicate:
- If the node does not fit the node predicate anymore, it will be removed.
- If the node was part of the external selection and now fits the node predicate, a new selection is compiled and emitted. Derived widgets can override the method if they want to react on modified nodes.
Reimplemented in QmitkSynchronizedNodeSelectionWidget.
◆ OnNodePredicateChanged()
virtual void QmitkAbstractNodeSelectionWidget::OnNodePredicateChanged |
( |
| ) |
|
|
protectedvirtual |
◆ OnNodeRemovedFromStorage()
virtual void QmitkAbstractNodeSelectionWidget::OnNodeRemovedFromStorage |
( |
const mitk::DataNode * |
node | ) |
|
|
protectedvirtual |
Method is called when a node is removed from the storage. The removed node is passed as variable. This member is called directly before the node will be removed from the current selection. Default implementation does nothing. Derived widgets can override the method if they want to handle to-be-removed nodes before.
◆ OnSelectionReceived()
void QmitkAbstractNodeSelectionWidget::OnSelectionReceived |
( |
const std::string & |
context, |
|
|
const std::vector< mitk::DataNode::Pointer > & |
selection |
|
) |
| |
|
overridevirtual |
Callback method for received selections.
- Parameters
-
context | An arbitrary string that sender and receiver agreed upon to establish a connection. |
selection | The sent selection of potentially multiple data nodes. |
Implements mitk::INodeSelectionListener.
◆ RemoveNodeFromSelection
void QmitkAbstractNodeSelectionWidget::RemoveNodeFromSelection |
( |
const mitk::DataNode * |
node | ) |
|
|
protectedslot |
◆ ReviseSelectionChanged()
virtual void QmitkAbstractNodeSelectionWidget::ReviseSelectionChanged |
( |
const NodeList & |
oldInternalSelection, |
|
|
NodeList & |
newInternalSelection |
|
) |
| |
|
protectedvirtual |
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 in QmitkSynchronizedNodeSelectionWidget, and QmitkSingleNodeSelectionWidget.
◆ SetCurrentInternalSelection()
void QmitkAbstractNodeSelectionWidget::SetCurrentInternalSelection |
( |
NodeList |
selectedNodes | ) |
|
|
protected |
◆ SetCurrentSelection
void QmitkAbstractNodeSelectionWidget::SetCurrentSelection |
( |
NodeList |
selectedNodes | ) |
|
|
slot |
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.
The function filters the given list of nodes according to the 'm_SelectOnlyVisibleNodes' member variable. If necessary, the non-visible nodes are stored. This is done if 'm_SelectOnlyVisibleNodes' is false: In this case the selection may be filtered and only a subset of the selected nodes may be visible and therefore (de-)selectable in the data storage viewer. By storing the non-visible nodes it is possible to send the new, modified selection but also include the selected nodes from the original selection that could not be modified (see 'SetSelectOnlyVisibleNodes').
- nodes A list of data nodes that should be newly selected.
◆ SetDataStorage()
void QmitkAbstractNodeSelectionWidget::SetDataStorage |
( |
mitk::DataStorage * |
dataStorage | ) |
|
Sets the data storage that will be used / monitored by widget.
- dataStorage A pointer to the data storage to set.
◆ SetEmptyInfo
void QmitkAbstractNodeSelectionWidget::SetEmptyInfo |
( |
QString |
info | ) |
|
|
slot |
Set the info text that should be displayed if no (valid) node is selected, but a selection is optional. The string can contain HTML code, if desired.
◆ SetInvalidInfo
void QmitkAbstractNodeSelectionWidget::SetInvalidInfo |
( |
QString |
info | ) |
|
|
slot |
Set the info text that should be displayed if no (valid) node is selected, but a selection is mandatory. The string can contain HTML code, if desired.
◆ SetNodePredicate()
Sets the node predicate and updates the widget, according to the node predicate. Implement OnNodePredicateChange() for custom actualization of a derived widget class.
- nodePredicate A pointer to node predicate.
◆ SetPopUpHint
void QmitkAbstractNodeSelectionWidget::SetPopUpHint |
( |
QString |
info | ) |
|
|
slot |
Set the hint text of the popup that is displayed to alter the selection. The string can contain HTML code, if desired.
◆ SetPopUpTitel
void QmitkAbstractNodeSelectionWidget::SetPopUpTitel |
( |
QString |
info | ) |
|
|
slot |
Set the caption of the popup that is displayed to alter the selection. The string can contain HTML code, if desired.
◆ SetSelectionIsOptional
void QmitkAbstractNodeSelectionWidget::SetSelectionIsOptional |
( |
bool |
isOptional | ) |
|
|
slot |
Set the widget into an optional mode. Optional means that the selection of no valid node does not mean an invalid state. Thus no node is a valid "node" selection too.
◆ SetSelectOnlyVisibleNodes
void QmitkAbstractNodeSelectionWidget::SetSelectOnlyVisibleNodes |
( |
bool |
selectOnlyVisibleNodes | ) |
|
|
slot |
Change the selection modus of the item view's selection model.
If true, an incoming selection will be filtered (reduced) to only those nodes that are visible by the current view. An outgoing selection can then at most contain the filtered nodes. If false, the incoming non-visible selection will be stored and later added to the outgoing selection, to include the original selection that could not be modified. The part of the original selection, that is non-visible are the nodes, that do not fullfill the predicate.
- selectOnlyVisibleNodes The bool value to define the selection modus.
◆ UpdateInfo()
virtual void QmitkAbstractNodeSelectionWidget::UpdateInfo |
( |
| ) |
|
|
protectedpure virtual |
◆ m_DataStorage
◆ m_EmptyInfo
QString QmitkAbstractNodeSelectionWidget::m_EmptyInfo |
|
protected |
◆ m_InvalidInfo
QString QmitkAbstractNodeSelectionWidget::m_InvalidInfo |
|
protected |
◆ m_IsOptional
bool QmitkAbstractNodeSelectionWidget::m_IsOptional |
|
protected |
◆ m_NodePredicate
◆ m_PopUpHint
QString QmitkAbstractNodeSelectionWidget::m_PopUpHint |
|
protected |
◆ m_PopUpTitel
QString QmitkAbstractNodeSelectionWidget::m_PopUpTitel |
|
protected |
◆ m_SelectOnlyVisibleNodes
bool QmitkAbstractNodeSelectionWidget::m_SelectOnlyVisibleNodes |
|
protected |
The documentation for this class was generated from the following file: