Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Abstract base class for the selection of data from a data storage. More...
#include <QmitkAbstractNodeSelectionWidget.h>
Public Types | |
using | NodeList = QList< mitk::DataNode::Pointer > |
Public Slots | |
void | SetSelectOnlyVisibleNodes (bool selectOnlyVisibleNodes) |
void | SetCurrentSelection (NodeList selectedNodes) |
void | SetInvalidInfo (QString info) |
void | SetEmptyInfo (QString info) |
void | SetPopUpTitel (QString info) |
void | SetPopUpHint (QString info) |
void | SetSelectionIsOptional (bool isOptional) |
Signals | |
void | CurrentSelectionChanged (NodeList nodes) |
Public Member Functions | |
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::NodePredicateBase * | GetNodePredicate () const |
QString | GetInvalidInfo () const |
QString | GetEmptyInfo () const |
QString | GetPopUpTitel () const |
QString | GetPopUpHint () const |
bool | GetSelectionIsOptional () const |
bool | GetSelectOnlyVisibleNodes () const |
NodeList | GetSelectedNodes () const |
Protected Slots | |
void | RemoveNodeFromSelection (const mitk::DataNode *node) |
Protected Member Functions | |
virtual void | UpdateInfo ()=0 |
virtual void | OnNodePredicateChanged () |
virtual void | OnDataStorageChanged () |
virtual void | OnInternalSelectionChanged () |
virtual void | OnNodeAddedToStorage (const mitk::DataNode *node) |
virtual void | OnNodeRemovedFromStorage (const mitk::DataNode *node) |
void | HandleChangeOfInternalSelection (NodeList newInternalSelection) |
NodeList | CompileEmitSelection () const |
virtual void | ReviseSelectionChanged (const NodeList &oldInternalSelection, NodeList &newInternalSelection) |
virtual bool | AllowEmissionOfSelection (const NodeList &emissionCandidates) const |
void | EmitSelection (const NodeList &emissionCandidates) |
void | SetCurrentInternalSelection (NodeList selectedNodes) |
const NodeList & | GetCurrentInternalSelection () const |
const NodeList & | GetCurrentExternalSelection () const |
Protected Attributes | |
mitk::WeakPointer< mitk::DataStorage > | m_DataStorage |
mitk::NodePredicateBase::ConstPointer | m_NodePredicate |
QString | m_InvalidInfo |
QString | m_EmptyInfo |
QString | m_PopUpTitel |
QString | m_PopUpHint |
bool | m_IsOptional |
bool | m_SelectOnlyVisibleNodes |
Abstract base class for the selection of data from a data storage.
Definition at line 32 of file QmitkAbstractNodeSelectionWidget.h.
Definition at line 66 of file QmitkAbstractNodeSelectionWidget.h.
|
explicit |
Definition at line 17 of file QmitkAbstractNodeSelectionWidget.cpp.
|
overridevirtual |
Definition at line 23 of file QmitkAbstractNodeSelectionWidget.cpp.
References mitk::WeakPointer< T >::Lock(), and m_DataStorage.
|
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.
emissionCandidates | The nodes that will be emitted if the function returns true. |
Reimplemented in QmitkMultiNodeSelectionWidget.
Definition at line 251 of file QmitkAbstractNodeSelectionWidget.cpp.
Referenced by EmitSelection(), and RemoveNodeFromSelection().
|
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).
Definition at line 324 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_NodePredicate, and m_SelectOnlyVisibleNodes.
Referenced by QmitkSingleNodeSelectionWidget::eventFilter(), GetSelectedNodes(), HandleChangeOfInternalSelection(), QmitkMultiNodeSelectionWidget::OnEditSelection(), RemoveNodeFromSelection(), QmitkMultiNodeSelectionWidget::SetSelectionCheckFunction(), and SetSelectOnlyVisibleNodes().
|
signal |
Referenced by EmitSelection().
|
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 emited.
Definition at line 256 of file QmitkAbstractNodeSelectionWidget.cpp.
References AllowEmissionOfSelection(), CurrentSelectionChanged(), and EqualNodeSelections().
Referenced by HandleChangeOfInternalSelection(), RemoveNodeFromSelection(), QmitkMultiNodeSelectionWidget::SetSelectionCheckFunction(), and SetSelectOnlyVisibleNodes().
|
protected |
Definition at line 288 of file QmitkAbstractNodeSelectionWidget.cpp.
|
protected |
Definition at line 283 of file QmitkAbstractNodeSelectionWidget.cpp.
Referenced by QmitkSingleNodeSelectionWidget::EditSelection(), QmitkSingleNodeSelectionWidget::GetSelectedNode(), and QmitkMultiNodeSelectionWidget::OnInternalSelectionChanged().
QString QmitkAbstractNodeSelectionWidget::GetEmptyInfo | ( | ) | const |
Definition at line 176 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_EmptyInfo.
QString QmitkAbstractNodeSelectionWidget::GetInvalidInfo | ( | ) | const |
Definition at line 171 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_InvalidInfo.
const mitk::NodePredicateBase * QmitkAbstractNodeSelectionWidget::GetNodePredicate | ( | ) | const |
Definition at line 166 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_NodePredicate.
QString QmitkAbstractNodeSelectionWidget::GetPopUpHint | ( | ) | const |
Definition at line 186 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_PopUpHint.
QString QmitkAbstractNodeSelectionWidget::GetPopUpTitel | ( | ) | const |
Definition at line 181 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_PopUpTitel.
QmitkAbstractNodeSelectionWidget::NodeList QmitkAbstractNodeSelectionWidget::GetSelectedNodes | ( | ) | const |
Returns the selected nodes, as emitted with CurrentSelectionChanged
Definition at line 46 of file QmitkAbstractNodeSelectionWidget.cpp.
References CompileEmitSelection().
bool QmitkAbstractNodeSelectionWidget::GetSelectionIsOptional | ( | ) | const |
Definition at line 191 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_IsOptional.
bool QmitkAbstractNodeSelectionWidget::GetSelectOnlyVisibleNodes | ( | ) | const |
Definition at line 196 of file QmitkAbstractNodeSelectionWidget.cpp.
References m_SelectOnlyVisibleNodes.
|
protected |
Method is called if the internal selection has changed. It will call following methods, that can be overriden to change behavior in derived classes:
If the emission is needed and allowed it will also trigger the emission via EmitSelection().
Definition at line 131 of file QmitkAbstractNodeSelectionWidget.cpp.
References CompileEmitSelection(), EmitSelection(), OnInternalSelectionChanged(), ReviseSelectionChanged(), SetCurrentInternalSelection(), and UpdateInfo().
Referenced by QmitkSingleNodeSelectionWidget::EditSelection(), QmitkMultiNodeSelectionWidget::OnEditSelection(), QmitkSingleNodeSelectionWidget::OnNodeAddedToStorage(), RemoveNodeFromSelection(), SetCurrentSelection(), SetDataStorage(), SetNodePredicate(), and SetSelectionIsOptional().
|
protectedvirtual |
Method is called if the data storage has changed. The selection will be automatically be reseted afterwards. The default implementation does nothing.
Definition at line 297 of file QmitkAbstractNodeSelectionWidget.cpp.
Referenced by SetDataStorage(), and SetSelectionIsOptional().
|
protectedvirtual |
This member function will called when ever a new internal selection has been determined. This can be used to update the state of internal widgets. The default implementation does nothing.
Reimplemented in QmitkMultiNodeSelectionWidget.
Definition at line 301 of file QmitkAbstractNodeSelectionWidget.cpp.
References OnNodeAddedToStorage().
Referenced by HandleChangeOfInternalSelection().
|
protectedvirtual |
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 in QmitkSingleNodeSelectionWidget.
Definition at line 310 of file QmitkAbstractNodeSelectionWidget.cpp.
References OnNodeRemovedFromStorage(), and RemoveNodeFromSelection().
Referenced by OnInternalSelectionChanged().
|
protectedvirtual |
Method is called if the predicate has changed, before the selection will be updated according to the new predicate. The default implementation does nothing.
Definition at line 293 of file QmitkAbstractNodeSelectionWidget.cpp.
Referenced by SetNodePredicate().
|
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 if he was a part. Default implementation does nothing.
Definition at line 320 of file QmitkAbstractNodeSelectionWidget.cpp.
Referenced by OnNodeAddedToStorage().
|
protectedslot |
Call to remove a node from the current selection. If the node is part of the current selection, this will trigger ReviseSelectionChanged(), AllowEmissionOfSelection() and if there is really a change, will also emit CurrentSelectionChanged.
Definition at line 342 of file QmitkAbstractNodeSelectionWidget.cpp.
References AllowEmissionOfSelection(), CompileEmitSelection(), EmitSelection(), HandleChangeOfInternalSelection(), m_NodePredicate, MITK_ERROR, and UpdateInfo().
Referenced by QmitkMultiNodeSelectionWidget::OnClearSelection(), and OnNodeAddedToStorage().
|
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 QmitkSingleNodeSelectionWidget.
Definition at line 247 of file QmitkAbstractNodeSelectionWidget.cpp.
Referenced by HandleChangeOfInternalSelection().
|
protected |
Definition at line 268 of file QmitkAbstractNodeSelectionWidget.cpp.
Referenced by HandleChangeOfInternalSelection().
|
slot |
Definition at line 146 of file QmitkAbstractNodeSelectionWidget.cpp.
References HandleChangeOfInternalSelection(), mitk::WeakPointer< T >::Lock(), m_DataStorage, and m_NodePredicate.
Referenced by QmitkSingleNodeSelectionWidget::OnClearSelection(), and QmitkSingleNodeSelectionWidget::SetCurrentSelectedNode().
void QmitkAbstractNodeSelectionWidget::SetDataStorage | ( | mitk::DataStorage * | dataStorage | ) |
Sets the data storage that will be used /monitored by widget.
Definition at line 51 of file QmitkAbstractNodeSelectionWidget.cpp.
References HandleChangeOfInternalSelection(), mitk::WeakPointer< T >::Lock(), m_DataStorage, and OnDataStorageChanged().
|
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 wanted
Definition at line 219 of file QmitkAbstractNodeSelectionWidget.cpp.
References info(), m_EmptyInfo, and UpdateInfo().
|
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 wanted
Definition at line 213 of file QmitkAbstractNodeSelectionWidget.cpp.
References info(), m_InvalidInfo, and UpdateInfo().
void QmitkAbstractNodeSelectionWidget::SetNodePredicate | ( | const mitk::NodePredicateBase * | nodePredicate | ) |
Sets the node predicate and updates the widget, according to the node predicate. Implement OnNodePredicateChange() for custom actualization of a derived widget class.
Definition at line 98 of file QmitkAbstractNodeSelectionWidget.cpp.
References HandleChangeOfInternalSelection(), m_NodePredicate, m_SelectOnlyVisibleNodes, and OnNodePredicateChanged().
|
slot |
Set the hint text of the popup that is displayed to alter the selection. The string can contain HTML code. if wanted
Definition at line 230 of file QmitkAbstractNodeSelectionWidget.cpp.
References info(), and m_PopUpHint.
|
slot |
Set the caption of the popup that is displayed to alter the selection. The string can contain HTML code. if wanted
Definition at line 225 of file QmitkAbstractNodeSelectionWidget.cpp.
References info(), and m_PopUpTitel.
|
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.
Definition at line 235 of file QmitkAbstractNodeSelectionWidget.cpp.
References HandleChangeOfInternalSelection(), m_IsOptional, OnDataStorageChanged(), and UpdateInfo().
|
slot |
Definition at line 201 of file QmitkAbstractNodeSelectionWidget.cpp.
References CompileEmitSelection(), EmitSelection(), and m_SelectOnlyVisibleNodes.
|
protectedpure virtual |
Method is called if the display of the selected nodes should be updated (e.g. because the selection changed)
Implemented in QmitkSingleNodeSelectionWidget, and QmitkMultiNodeSelectionWidget.
Referenced by HandleChangeOfInternalSelection(), RemoveNodeFromSelection(), SetEmptyInfo(), SetInvalidInfo(), and SetSelectionIsOptional().
|
protected |
Definition at line 195 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by QmitkSingleNodeSelectionWidget::DetermineAutoSelectNode(), QmitkSingleNodeSelectionWidget::EditSelection(), QmitkMultiNodeSelectionWidget::OnEditSelection(), SetCurrentSelection(), SetDataStorage(), and ~QmitkAbstractNodeSelectionWidget().
|
protected |
Definition at line 199 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by GetEmptyInfo(), SetEmptyInfo(), QmitkMultiNodeSelectionWidget::UpdateInfo(), and QmitkSingleNodeSelectionWidget::UpdateInfo().
|
protected |
Definition at line 198 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by GetInvalidInfo(), SetInvalidInfo(), QmitkMultiNodeSelectionWidget::UpdateInfo(), and QmitkSingleNodeSelectionWidget::UpdateInfo().
|
protected |
See documentation of SetSelectOnlyVisibleNodes for details
Definition at line 204 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by GetSelectionIsOptional(), QmitkSingleNodeSelectionWidget::OnClearSelection(), QmitkMultiNodeSelectionWidget::OnInternalSelectionChanged(), SetSelectionIsOptional(), QmitkMultiNodeSelectionWidget::UpdateInfo(), and QmitkSingleNodeSelectionWidget::UpdateInfo().
|
protected |
Definition at line 196 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by CompileEmitSelection(), QmitkSingleNodeSelectionWidget::DetermineAutoSelectNode(), QmitkSingleNodeSelectionWidget::EditSelection(), GetNodePredicate(), QmitkMultiNodeSelectionWidget::OnEditSelection(), QmitkMultiNodeSelectionWidget::OnInternalSelectionChanged(), RemoveNodeFromSelection(), SetCurrentSelection(), and SetNodePredicate().
|
protected |
Definition at line 201 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by QmitkSingleNodeSelectionWidget::EditSelection(), GetPopUpHint(), QmitkMultiNodeSelectionWidget::OnEditSelection(), and SetPopUpHint().
|
protected |
Definition at line 200 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by QmitkSingleNodeSelectionWidget::EditSelection(), GetPopUpTitel(), QmitkMultiNodeSelectionWidget::OnEditSelection(), and SetPopUpTitel().
|
protected |
See documentation of SetSelectionIsOptional for details
Definition at line 206 of file QmitkAbstractNodeSelectionWidget.h.
Referenced by CompileEmitSelection(), QmitkSingleNodeSelectionWidget::EditSelection(), GetSelectOnlyVisibleNodes(), QmitkMultiNodeSelectionWidget::OnEditSelection(), SetNodePredicate(), and SetSelectOnlyVisibleNodes().