Medical Imaging Interaction Toolkit  2023.12.99-ed252ae7
Medical Imaging Interaction Toolkit
QmitkAbstractView Class Reference

A convenient base class for MITK related BlueBerry Views. More...

#include <QmitkAbstractView.h>

Inheritance diagram for QmitkAbstractView:
Collaboration diagram for QmitkAbstractView:

Public Member Functions

 berryObjectMacro (QmitkAbstractView)
 
 QmitkAbstractView ()
 
 ~QmitkAbstractView () override
 
- 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
 
void SetFocus () override=0
 
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

void FireNodeSelected (mitk::DataNode::Pointer node)
 
virtual void FireNodesSelected (const QList< mitk::DataNode::Pointer > &nodes)
 
QList< mitk::DataNode::PointerGetCurrentSelection () const
 
bool IsCurrentSelectionValid () const
 
QList< mitk::DataNode::PointerGetDataManagerSelection () const
 
bool IsDataManagerSelectionValid () const
 
void SetDataManagerSelection (const berry::ISelection::ConstPointer &selection, QItemSelectionModel::SelectionFlags flags=QItemSelectionModel::ClearAndSelect) const
 
void SynchronizeDataManagerSelection () const
 
virtual mitk::IPreferencesGetPreferences () const
 
mitk::IDataStorageReference::Pointer GetDataStorageReference () const
 
mitk::DataStorage::Pointer GetDataStorage () const
 
mitk::IRenderWindowPartGetRenderWindowPart (mitk::WorkbenchUtil::IRenderWindowPartStrategies strategies=mitk::WorkbenchUtil::NONE) const
 
void RequestRenderWindowUpdate (mitk::RenderingManager::RequestType requestType=mitk::RenderingManager::REQUEST_UPDATE_ALL)
 
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 ()
 
- 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
 

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 ()
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

A convenient base class for MITK related BlueBerry Views.

QmitkAbstractView provides several convenience methods that ease the introduction of a new view:

  1. Access to the DataStorage (~ the shared data repository)
  2. Access to the active IRenderWindowPart
  3. Access to and update notification for the view's preferences
  4. Access to and update notification for the current DataNode selection / to DataNode selection events send through the SelectionService
  5. Access to and update notification for DataNode events (added/removed/modified)
  6. Methods to send DataNode selections through the SelectionService
  7. Some minor important convenience methods (like changing the mouse cursor/exception handling)

Usually all MITK Views inherit from QmitkAbstractView to achieve a consistent Workbench behavior.

When inheriting from QmitkAbstractView, you must implement the following methods:

You may reimplement the following private virtual methods to customize your View's behavior:

  • void SetSelectionProvider()
  • QItemSelectionModel* GetDataNodeSelectionModel() const

You may reimplement the following private virtual methods to be notified about certain changes:

  • void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes)
  • void OnNullSelection(berry::IWorkbenchPart::Pointer part)
  • void OnPreferencesChanged(const mitk::IPreferences*)
  • void NodeAdded(const mitk::DataNode* node)
  • void NodeChanged(const mitk::DataNode* node)
  • void NodeRemoved(const mitk::DataNode* node)
  • void DataStorageModified()
  • void DataStorageChanged(mitk::IDataStorageReference::Pointer dsRef)
See also
mitk::ILifecycleAwarePart
mitk::IZombieViewPart
mitk::IRenderWindowPartListener

Definition at line 89 of file QmitkAbstractView.h.

Constructor & Destructor Documentation

◆ QmitkAbstractView()

QmitkAbstractView::QmitkAbstractView ( )

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

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

◆ ~QmitkAbstractView()

QmitkAbstractView::~QmitkAbstractView ( )
override

Disconnects all standard event listeners

Member Function Documentation

◆ berryObjectMacro()

QmitkAbstractView::berryObjectMacro ( QmitkAbstractView  )

Creates smartpointer typedefs

◆ BusyCursorOff()

void QmitkAbstractView::BusyCursorOff ( )
protected

Convenient method to restore the standard cursor

◆ BusyCursorOn()

void QmitkAbstractView::BusyCursorOn ( )
protected

Convenient method to set and reset a busy cursor

◆ FireNodeSelected()

void QmitkAbstractView::FireNodeSelected ( mitk::DataNode::Pointer  node)
protected

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

Note
This method should not be used if you have set your own selection provider via SetSelectionProvider() or your own QItemSelectionModel via GetDataNodeSelectionModel().

◆ FireNodesSelected()

virtual void QmitkAbstractView::FireNodesSelected ( const QList< mitk::DataNode::Pointer > &  nodes)
protectedvirtual

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

Note
This method should not be used if you have set your own selection provider via SetSelectionProvider() or your own QItemSelectionModel via GetDataNodeSelectionModel().

◆ GetCurrentSelection()

QList<mitk::DataNode::Pointer> QmitkAbstractView::GetCurrentSelection ( ) const
protected
Returns
The selection of the currently active part of the workbench or an empty list if there is no selection or if it is empty.
See also
IsCurrentSelectionValid

◆ GetDataManagerSelection()

QList<mitk::DataNode::Pointer> QmitkAbstractView::GetDataManagerSelection ( ) const
protected

Returns the current selection made in the datamanager bundle or an empty list if there is no selection or if it is empty.

See also
IsDataManagerSelectionValid

◆ GetDataStorage()

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

Returns the currently active DataStorage.

◆ GetDataStorageReference()

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

Returns a reference to the currently active DataStorage.

◆ GetPreferences()

virtual mitk::IPreferences* QmitkAbstractView::GetPreferences ( ) const
protectedvirtual

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

◆ GetRenderWindowPart()

mitk::IRenderWindowPart* QmitkAbstractView::GetRenderWindowPart ( mitk::WorkbenchUtil::IRenderWindowPartStrategies  strategies = mitk::WorkbenchUtil::NONE) const
protected

Returns the currently active mitk::IRenderWindowPart.

Parameters
strategiesStrategies for returning a mitk::IRenderWindowPart instance if there is currently no active one.
Returns
The active mitk::IRenderWindowPart.

◆ HandleException() [1/2]

void QmitkAbstractView::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 )

◆ HandleException() [2/2]

void QmitkAbstractView::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

◆ IsCurrentSelectionValid()

bool QmitkAbstractView::IsCurrentSelectionValid ( ) const
protected

Queries the state of the current selection.

Returns
If the current selection is nullptr, this method returns false and true otherwise.

◆ IsDataManagerSelectionValid()

bool QmitkAbstractView::IsDataManagerSelectionValid ( ) const
protected

Queries the state of the current selection of the data manager view.

Returns
If the current data manager selection is nullptr, this method returns false and true otherwise.

◆ RequestRenderWindowUpdate()

void QmitkAbstractView::RequestRenderWindowUpdate ( mitk::RenderingManager::RequestType  requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL)
protected

Request an update of all render windows of the currently active IRenderWindowPart.

Parameters
requestTypeSpecifies the type of render windows for which an update will be requested.

◆ RestoreOverrideCursor()

void QmitkAbstractView::RestoreOverrideCursor ( )
protected

Convenient method to restore the standard cursor

◆ SetDataManagerSelection()

void QmitkAbstractView::SetDataManagerSelection ( const berry::ISelection::ConstPointer selection,
QItemSelectionModel::SelectionFlags  flags = QItemSelectionModel::ClearAndSelect 
) const
protected

Sets the selection of the data manager view if available.

Parameters
selectionThe new selection for the data manager.
flagsThe Qt selection flags for controlling the way how the selection is updated.

◆ SynchronizeDataManagerSelection()

void QmitkAbstractView::SynchronizeDataManagerSelection ( ) const
protected

Takes the current selection and sets it on the data manager. Only matching nodes in the data manager view will be selected.

◆ WaitCursorOff()

void QmitkAbstractView::WaitCursorOff ( )
protected

Convenient method to restore the standard cursor

◆ WaitCursorOn()

void QmitkAbstractView::WaitCursorOn ( )
protected

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


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