Medical Imaging Interaction Toolkit  2021.10.99-9c07a326
Medical Imaging Interaction Toolkit
QmitkFunctionality Class Reference

The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Functionality") More...

#include <QmitkFunctionality.h>

Inheritance diagram for QmitkFunctionality:
Collaboration diagram for QmitkFunctionality:

Public Member Functions

 berryObjectMacro (QmitkFunctionality)
 
 QmitkFunctionality ()
 
 ~QmitkFunctionality () override
 
virtual void ClosePart ()
 
virtual void OnSelectionChanged (std::vector< mitk::DataNode *>)
 
virtual void OnPreferencesChanged (const berry::IBerryPreferences *)
 
void SetHandleMultipleDataStorages (bool multiple)
 
bool HandlesMultipleDataStorages () const
 
virtual void MultiWidgetAvailable (QmitkAbstractMultiWidget &multiWidget)
 
virtual void MultiWidgetClosed (QmitkAbstractMultiWidget &multiWidget)
 
virtual void MultiWidgetNotAvailable ()
 
virtual void Activated ()
 
bool IsActivated () const
 
virtual void Deactivated ()
 
virtual bool IsExclusiveFunctionality () const
 
void FireNodeSelected (mitk::DataNode *node)
 
void FireNodesSelected (std::vector< mitk::DataNode *> nodes)
 
virtual void Visible ()
 
bool IsVisible () const
 
virtual void Hidden ()
 
void CreatePartControl (QWidget *parent) override
 
void SetFocus () override
 
void NodeAddedProxy (const mitk::DataNode *node)
 
void NodeRemovedProxy (const mitk::DataNode *node)
 
void NodeChangedProxy (const mitk::DataNode *node)
 
void SetVisible (bool visible)
 
void SetActivated (bool activated)
 
void ClosePartProxy ()
 
- Public Member Functions inherited from berry::QtViewPart
 berryObjectMacro (QtViewPart)
 
- Public Member Functions inherited from berry::ViewPart
 berryObjectMacro (ViewPart, WorkbenchPart, IViewPart)
 
void Init (IViewSite::Pointer site, IMemento::Pointer memento=IMemento::Pointer(nullptr)) override
 
void SaveState (IMemento::Pointer memento) override
 
IViewSite::Pointer GetViewSite () override
 
- Public Member Functions inherited from berry::WorkbenchPart
 berryObjectMacro (WorkbenchPart, QObject, IWorkbenchPart, IExecutableExtension)
 
 ~WorkbenchPart () override
 
void AddPropertyListener (IPropertyChangeListener *l) override
 
void RemovePropertyListener (IPropertyChangeListener *l) override
 
void SetPartProperty (const QString &key, const QString &value) override
 
QString GetPartProperty (const QString &key) const override
 
const QHash< QString, QString > & GetPartProperties () const override
 
void SetInitializationData (const IConfigurationElement::Pointer &cfig, const QString &propertyName, const Object::Pointer &data) override
 
IWorkbenchPartSite::Pointer GetSite () const override
 
QString GetPartName () const override
 
QString GetContentDescription () const override
 
QIcon GetTitleImage () const override
 
QString GetTitleToolTip () const override
 
- Public Member Functions inherited from berry::IWorkbenchPart
 berryObjectMacro (berry::IWorkbenchPart, Object)
 
 ~IWorkbenchPart () override
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual QString ToString () const
 
virtual uint HashCode () const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
virtual bool operator== (const Object *) const
 
- Public Member Functions inherited from berry::IExecutableExtension
virtual ~IExecutableExtension ()
 
virtual void SetInitializationData (const SmartPointer< IConfigurationElement > &config, const QString &propertyName, const Object::Pointer &data)=0
 
- Public Member Functions inherited from berry::IViewPart
 berryObjectMacro (berry::IViewPart, IWorkbenchPart)
 
 ~IViewPart () override
 

Protected Member Functions

virtual void NodeAdded (const mitk::DataNode *node)
 
virtual void NodeChanged (const mitk::DataNode *)
 
virtual void NodeRemoved (const mitk::DataNode *node)
 
virtual void DataStorageChanged ()
 
std::vector< mitk::DataNode * > GetCurrentSelection () const
 
std::vector< mitk::DataNode * > GetDataManagerSelection () const
 
berry::IPreferences::Pointer GetPreferences () const
 
mitk::DataStorage::Pointer GetDataStorage () const
 
mitk::DataStorage::Pointer GetDefaultDataStorage () const
 
mitk::IDataStorageReference::Pointer GetDataStorageReference () const
 
QmitkAbstractMultiWidgetGetActiveMultiWidget (bool reCreateWidget=true)
 
void HandleException (std::exception &e, QWidget *parent=nullptr, bool showDialog=true) const
 
void HandleException (const char *str, QWidget *parent=nullptr, bool showDialog=true) const
 
void WaitCursorOn ()
 
void WaitCursorOff ()
 
void BusyCursorOn ()
 
void BusyCursorOff ()
 
void RestoreOverrideCursor ()
 
void AfterCreateQtPartControl ()
 
void ActivateLastVisibleFunctionality ()
 
void BlueBerrySelectionChanged (const berry::IWorkbenchPart::Pointer &sourcepart, const berry::ISelection::ConstPointer &selection)
 
std::vector< mitk::DataNode * > DataNodeSelectionToVector (mitk::DataNodeSelection::ConstPointer currentSelection) const
 
- Protected Member Functions inherited from berry::QtViewPart
virtual void CreateQtPartControl (QWidget *parent)=0
 
- Protected Member Functions inherited from berry::ViewPart
 ViewPart ()
 
void CheckSite (IWorkbenchPartSite::Pointer site) override
 
- Protected Member Functions inherited from berry::WorkbenchPart
 WorkbenchPart ()
 
IConfigurationElement::Pointer GetConfigurationElement () const
 
void SetSite (IWorkbenchPartSite::Pointer site)
 
virtual void SetTitleImage (const QIcon &titleImage)
 
virtual void SetTitleToolTip (const QString &toolTip)
 
virtual void SetPartName (const QString &partName)
 
virtual void SetContentDescription (const QString &description)
 
void FirePropertyChanged (const QString &key, const QString &oldValue, const QString &newValue)
 
void FirePropertyChange (int propertyId)
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 

Protected Attributes

QWidget * m_Parent
 
bool m_Active
 
bool m_Visible
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Additional Inherited Members

- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 

Detailed Description

The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Functionality")

QmitkFunctionality provides several convenience methods that eases the introduction of a new view:

  1. Access to the DataStorage (~ the shared data repository)
  2. Access to the MultiWidget
  3. Access to and update notification for the functionality/view preferences
  4. Access to and update notification for the current DataNode selection / to DataNode selection events send through the SelectionService
  5. Methods to send DataNode selections through the SelectionService
  6. Some events for unproblematic inter-View communication (e.g. when to add/remove interactors)
  7. Some minor important convenience methods (like changing the mouse cursor/exception handling)

Please use the Activated/Deactivated method to add/remove interactors, disabling multiwidget crosshair or anything which may "affect" other functionalities. For further reading please have a look at QmitkFunctionality::IsExclusiveFunctionality().

Definition at line 70 of file QmitkFunctionality.h.

Constructor & Destructor Documentation

◆ QmitkFunctionality()

QmitkFunctionality::QmitkFunctionality ( )

Nothing to do in the standard ctor. Initiliaze your GUI in CreateQtPartControl(QWidget*)

See also
berry::QtViewPart::CreateQtPartControl(QWidget*)

◆ ~QmitkFunctionality()

QmitkFunctionality::~QmitkFunctionality ( )
override

Disconnects all standard event listeners

Member Function Documentation

◆ Activated()

virtual void QmitkFunctionality::Activated ( )
virtual

Only called when IsExclusiveFunctionality() returns true.

See also
IsExclusiveFunctionality()

◆ ActivateLastVisibleFunctionality()

void QmitkFunctionality::ActivateLastVisibleFunctionality ( )
protected

code to activate the last visible functionality

◆ AfterCreateQtPartControl()

void QmitkFunctionality::AfterCreateQtPartControl ( )
protected

Called immediately after CreateQtPartControl(). Here standard event listeners for a QmitkFunctionality are registered

◆ berryObjectMacro()

QmitkFunctionality::berryObjectMacro ( QmitkFunctionality  )

Creates smartpointer typedefs

◆ BlueBerrySelectionChanged()

void QmitkFunctionality::BlueBerrySelectionChanged ( const berry::IWorkbenchPart::Pointer sourcepart,
const berry::ISelection::ConstPointer selection 
)
protected

reactions to selection events from data manager (and potential other senders)

◆ BusyCursorOff()

void QmitkFunctionality::BusyCursorOff ( )
protected

Convenient method to restore the standard cursor

◆ BusyCursorOn()

void QmitkFunctionality::BusyCursorOn ( )
protected

Convenient method to set and reset a busy cursor

◆ ClosePart()

virtual void QmitkFunctionality::ClosePart ( )
virtual

Called, when the WorkbenchPart gets closed by the user directly or by closing the whole app (e.g. for removing event listeners)

◆ ClosePartProxy()

void QmitkFunctionality::ClosePartProxy ( )

Called, when the WorkbenchPart gets closed for removing event listeners Internally this method calls ClosePart after it removed the listeners registered by QmitkFunctionality. By having this proxy method the user does not have to call QmitkFunctionality::ClosePart() when overwriting ClosePart()

◆ CreatePartControl()

void QmitkFunctionality::CreatePartControl ( QWidget *  parent)
overridevirtual

Creates a scroll area for this view and calls CreateQtPartControl then

Reimplemented from berry::QtViewPart.

◆ DataNodeSelectionToVector()

std::vector<mitk::DataNode*> QmitkFunctionality::DataNodeSelectionToVector ( mitk::DataNodeSelection::ConstPointer  currentSelection) const
protected

Converts a mitk::DataNodeSelection to a std::vector<mitk::DataNode*> (possibly empty

◆ DataStorageChanged()

virtual void QmitkFunctionality::DataStorageChanged ( )
protectedvirtual

Called when a DataStorage add or remove or change event was thrown. May be reimplemented by deriving classes.

◆ Deactivated()

virtual void QmitkFunctionality::Deactivated ( )
virtual

Only called when IsExclusiveFunctionality() returns true.

See also
IsExclusiveFunctionality()

◆ FireNodeSelected()

void QmitkFunctionality::FireNodeSelected ( mitk::DataNode node)

Informs other parts of the workbench that node is selected via the blueberry selection service.

◆ FireNodesSelected()

void QmitkFunctionality::FireNodesSelected ( std::vector< mitk::DataNode *>  nodes)

Informs other parts of the workbench that the nodes are selected via the blueberry selection service.

◆ GetActiveMultiWidget()

QmitkAbstractMultiWidget* QmitkFunctionality::GetActiveMultiWidget ( bool  reCreateWidget = true)
protected

Returns the default and active MultiWidget.

Parameters
reCreateWidgeta boolean flag to en-/disable the attempt to re-create the StdWidget If there is not MultiWidget yet a new one is created in this method when called with default parameter!

◆ GetCurrentSelection()

std::vector<mitk::DataNode*> QmitkFunctionality::GetCurrentSelection ( ) const
protected
Returns
the selection of the currently active part of the workbench or an empty vector if nothing is selected

◆ GetDataManagerSelection()

std::vector<mitk::DataNode*> QmitkFunctionality::GetDataManagerSelection ( ) const
protected

Returns the current selection made in the datamanager bundle or an empty vector if nothing`s selected or if the bundle does not exist

◆ GetDataStorage()

mitk::DataStorage::Pointer QmitkFunctionality::GetDataStorage ( ) const
protected

Returns the default or the currently active DataStorage if m_HandlesMultipleDataStorages is set to true

See also
SetHandleMultipleDataStorages(bool)
HandlesMultipleDataStorages()

◆ GetDataStorageReference()

mitk::IDataStorageReference::Pointer QmitkFunctionality::GetDataStorageReference ( ) const
protected

◆ GetDefaultDataStorage()

mitk::DataStorage::Pointer QmitkFunctionality::GetDefaultDataStorage ( ) const
protected
Returns
always returns the default DataStorage

◆ GetPreferences()

berry::IPreferences::Pointer QmitkFunctionality::GetPreferences ( ) const
protected

Returns the Preferences object for this Functionality. Important: When refering to this preferences, e.g. in a PreferencePage: The ID for this preferences object is "/<VIEW-ID>", e.g. "/org.mitk.views.datamanager"

◆ HandleException() [1/2]

void QmitkFunctionality::HandleException ( std::exception &  e,
QWidget *  parent = nullptr,
bool  showDialog = true 
) const
protected

Outputs an error message to the console and displays a message box containing the exception description.

Parameters
ethe exception which should be handled
parent
showDialogcontrols, whether additionally a message box should be displayed to inform the user that something went wrong

◆ HandleException() [2/2]

void QmitkFunctionality::HandleException ( const char *  str,
QWidget *  parent = nullptr,
bool  showDialog = true 
) const
protected

Calls HandleException ( std::exception&, QWidget*, bool ) internally

See also
HandleException ( std::exception&, QWidget*, bool )

◆ HandlesMultipleDataStorages()

bool QmitkFunctionality::HandlesMultipleDataStorages ( ) const
Returns
true if this view handles multiple DataStorages, false otherwise

◆ Hidden()

virtual void QmitkFunctionality::Hidden ( )
virtual

Called when this functionality is hidden ( no matter what IsExclusiveFunctionality() returns )

◆ IsActivated()

bool QmitkFunctionality::IsActivated ( ) const
Returns
true if this view is currently activated, false otherwise

◆ IsExclusiveFunctionality()

virtual bool QmitkFunctionality::IsExclusiveFunctionality ( ) const
virtual

Some functionalities need to add special interactors, removes the crosshair from the multiwidget, etc. In this case the functionality has to tidy up when changing to another functionality which also wants to change the "default configuration". In the old Qt3-based version of MITK, two functionalities could never be opened at the same time so that the methods Activated() and Deactivated() were the right place for the functionalitites to add/remove their interactors, etc. This is still true for the new MITK Workbench, but as there can be several functionalities visible at the same time, the behaviour concerning when Activated() and Deactivated() are called has changed:

  1. Activated() and Deactivated() are only called if IsExclusiveFunctionality() returns true
  2. If only one standalone functionality is or becomes visible, Activated() will be called on that functionality
  3. If two or more standalone functionalities are visible, Activated() will be called on the functionality that receives focus, Deactivated() will be called on the one that looses focus, gets hidden or closed

As a consequence of 1. if you overwrite IsExclusiveFunctionality() and let it return false, you signalize the MITK Workbench that this functionality does nothing to the "default configuration" and can easily be visible while other functionalities are also visible.

By default the method returns true.

Returns
true if this functionality is meant to work as a standalone view, false otherwise

◆ IsVisible()

bool QmitkFunctionality::IsVisible ( ) const
Returns
true if this view is currently visible, false otherwise

◆ MultiWidgetAvailable()

virtual void QmitkFunctionality::MultiWidgetAvailable ( QmitkAbstractMultiWidget multiWidget)
virtual

Called when a MultiWidget is available. Should not be used anymore, see GetActiveMultiWidget()

See also
GetActiveMultiWidget()

◆ MultiWidgetClosed()

virtual void QmitkFunctionality::MultiWidgetClosed ( QmitkAbstractMultiWidget multiWidget)
virtual

Called when a MultiWidget is available. Should not be used anymore, see GetActiveMultiWidget()

See also
GetActiveMultiWidget()

◆ MultiWidgetNotAvailable()

virtual void QmitkFunctionality::MultiWidgetNotAvailable ( )
virtual

Called when no MultiWidget is available anymore. Should not be used anymore, see GetActiveMultiWidget()

See also
GetActiveMultiWidget()

◆ NodeAdded()

virtual void QmitkFunctionality::NodeAdded ( const mitk::DataNode node)
protectedvirtual

Called when a DataStorage Add event was thrown. May be reimplemented by deriving classes.

◆ NodeAddedProxy()

void QmitkFunctionality::NodeAddedProxy ( const mitk::DataNode node)

Called when a DataStorage Add Event was thrown. Sets m_InDataStorageChanged to true and calls NodeAdded afterwards.

See also
m_InDataStorageChanged

◆ NodeChanged()

virtual void QmitkFunctionality::NodeChanged ( const mitk::DataNode )
protectedvirtual

Called when a DataStorage Changed event was thrown. May be reimplemented by deriving classes.

◆ NodeChangedProxy()

void QmitkFunctionality::NodeChangedProxy ( const mitk::DataNode node)

Called when a DataStorage changed event was thrown. Sets m_InDataStorageChanged to true and calls NodeChanged afterwards.

See also
m_InDataStorageChanged

◆ NodeRemoved()

virtual void QmitkFunctionality::NodeRemoved ( const mitk::DataNode node)
protectedvirtual

Called when a DataStorage Remove event was thrown. May be reimplemented by deriving classes.

◆ NodeRemovedProxy()

void QmitkFunctionality::NodeRemovedProxy ( const mitk::DataNode node)

Called when a DataStorage remove event was thrown. Sets m_InDataStorageChanged to true and calls NodeRemoved afterwards.

See also
m_InDataStorageChanged

◆ OnPreferencesChanged()

virtual void QmitkFunctionality::OnPreferencesChanged ( const berry::IBerryPreferences )
virtual

Called when the preferences object of this view changed.

See also
GetPreferences()

◆ OnSelectionChanged()

virtual void QmitkFunctionality::OnSelectionChanged ( std::vector< mitk::DataNode *>  )
virtual

Called when the selection in the workbench changed

◆ RestoreOverrideCursor()

void QmitkFunctionality::RestoreOverrideCursor ( )
protected

Convenient method to restore the standard cursor

◆ SetActivated()

void QmitkFunctionality::SetActivated ( bool  activated)

Toggles the activated flag m_Activated

◆ SetFocus()

void QmitkFunctionality::SetFocus ( )
overridevirtual

Called when this view receives the focus. Same as Activated()

See also
Activated()

Implements berry::WorkbenchPart.

◆ SetHandleMultipleDataStorages()

void QmitkFunctionality::SetHandleMultipleDataStorages ( bool  multiple)

Make this view manage multiple DataStorage. If set to true GetDataStorage() will return the currently active DataStorage (and not the default one).

See also
GetDataStorage()

◆ SetVisible()

void QmitkFunctionality::SetVisible ( bool  visible)

Toggles the visible flag m_Visible

◆ Visible()

virtual void QmitkFunctionality::Visible ( )
virtual

Called when this functionality becomes visible ( no matter what IsExclusiveFunctionality() returns )

◆ WaitCursorOff()

void QmitkFunctionality::WaitCursorOff ( )
protected

Convenient method to restore the standard cursor

◆ WaitCursorOn()

void QmitkFunctionality::WaitCursorOn ( )
protected

Convenient method to set and reset a wait cursor ("hourglass")

Member Data Documentation

◆ m_Active

bool QmitkFunctionality::m_Active
protected

Saves if this view is the currently active one.

Definition at line 362 of file QmitkFunctionality.h.

◆ m_Parent

QWidget* QmitkFunctionality::m_Parent
protected

Saves the parent of this view (this is the scrollarea created in CreatePartControl(QWidget*)

See also
CreatePartControl(QWidget*)

Definition at line 358 of file QmitkFunctionality.h.

◆ m_Visible

bool QmitkFunctionality::m_Visible
protected

Saves if this view is visible

Definition at line 366 of file QmitkFunctionality.h.


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