Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Functionality") More...
#include <QmitkFunctionality.h>
Public Member Functions | |
berryObjectMacro (QmitkFunctionality) | |
QmitkFunctionality () | |
virtual | ~QmitkFunctionality () |
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 | StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) |
virtual void | StdMultiWidgetClosed (QmitkStdMultiWidget &stdMultiWidget) |
virtual void | StdMultiWidgetNotAvailable () |
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) void CreatePartControl(QWidget *parent) override | |
Public Member Functions inherited from berry::ViewPart | |
IViewSite::Pointer | GetViewSite () override |
Public Member Functions inherited from berry::WorkbenchPart | |
berryObjectMacro (WorkbenchPart, QObject, IWorkbenchPart, IExecutableExtension)~WorkbenchPart() | |
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) virtual ~IWorkbenchPart() | |
Public Member Functions inherited from berry::Object | |
virtual QString | GetClassName () const |
virtual Reflection::TypeInfo | GetTypeInfo () const |
virtual QList< Reflection::TypeInfo > | GetSuperclasses () 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) virtual ~IViewPart() | |
virtual void | Init (IViewSite::Pointer site, IMemento::Pointer memento=IMemento::Pointer(nullptr))=0 |
virtual void | SaveState (IMemento::Pointer memento)=0 |
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 |
QmitkStdMultiWidget * | GetActiveStdMultiWidget (bool reCreateWidget=true) |
void | HandleException (std::exception &e, QWidget *parent=NULL, bool showDialog=true) const |
void | HandleException (const char *str, QWidget *parent=NULL, 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< Self > | Pointer |
typedef berry::SmartPointer< const Self > | ConstPointer |
typedef berry::WeakPointer< Self > | WeakPtr |
typedef berry::WeakPointer< const Self > | ConstWeakPtr |
Static Public Member Functions inherited from berry::Object | |
static const char * | GetStaticClassName () |
static Reflection::TypeInfo | GetStaticTypeInfo () |
static QList< Reflection::TypeInfo > | GetStaticSuperclasses () |
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:
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 81 of file QmitkFunctionality.h.
QmitkFunctionality::QmitkFunctionality | ( | ) |
Nothing to do in the standard ctor. Initiliaze your GUI in CreateQtPartControl(QWidget*)
Definition at line 43 of file QmitkFunctionality.cpp.
|
virtual |
Disconnects all standard event listeners
Definition at line 218 of file QmitkFunctionality.cpp.
References ClosePartProxy(), berry::Object::Register(), and berry::Object::UnRegister().
|
virtual |
Only called when IsExclusiveFunctionality() returns true.
Definition at line 252 of file QmitkFunctionality.cpp.
Referenced by QmitkFunctionalityCoordinator::ActivateStandaloneFunctionality().
|
protected |
code to activate the last visible functionality
|
protected |
Called immediately after CreateQtPartControl(). Here standard event listeners for a QmitkFunctionality are registered
Definition at line 141 of file QmitkFunctionality.cpp.
References BlueBerrySelectionChanged(), berry::SmartPointer< TObjectType >::Cast(), GetActiveStdMultiWidget(), GetDataManagerSelection(), GetDefaultDataStorage(), GetPreferences(), berry::WorkbenchPart::GetSite(), berry::SmartPointer< TObjectType >::IsNotNull(), NodeAddedProxy(), NodeChangedProxy(), NodeRemovedProxy(), OnPreferencesChanged(), OnSelectionChanged(), and StdMultiWidgetAvailable().
Referenced by CreatePartControl().
QmitkFunctionality::berryObjectMacro | ( | QmitkFunctionality | ) |
Creates smartpointer typedefs
|
protected |
reactions to selection events from data manager (and potential other senders)
Definition at line 232 of file QmitkFunctionality.cpp.
References berry::SmartPointer< TObjectType >::Cast(), DataNodeSelectionToVector(), berry::SmartPointer< TObjectType >::IsNull(), and OnSelectionChanged().
Referenced by AfterCreateQtPartControl().
|
protected |
Convenient method to restore the standard cursor
Definition at line 332 of file QmitkFunctionality.cpp.
References RestoreOverrideCursor().
|
protected |
Convenient method to set and reset a busy cursor
Definition at line 322 of file QmitkFunctionality.cpp.
|
virtual |
Called, when the WorkbenchPart gets closed by the user directly or by closing the whole app (e.g. for removing event listeners)
Definition at line 183 of file QmitkFunctionality.cpp.
Referenced by 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()
Definition at line 188 of file QmitkFunctionality.cpp.
References berry::SmartPointer< TObjectType >::Cast(), ClosePart(), GetDefaultDataStorage(), GetPreferences(), berry::WorkbenchPart::GetSite(), berry::SmartPointer< TObjectType >::IsNotNull(), NodeAddedProxy(), NodeChangedProxy(), NodeRemovedProxy(), OnPreferencesChanged(), and berry::ISelectionService::RemovePostSelectionListener().
Referenced by ~QmitkFunctionality().
|
overridevirtual |
Creates a scroll area for this view and calls CreateQtPartControl then
Implements berry::WorkbenchPart.
Definition at line 105 of file QmitkFunctionality.cpp.
References AfterCreateQtPartControl(), berry::QtViewPart::CreateQtPartControl(), and m_Parent.
|
protected |
Converts a mitk::DataNodeSelection to a std::vector<mitk::DataNode*> (possibly empty
Definition at line 45 of file QmitkFunctionality2.cpp.
References mitk::DataNodeObject::GetDataNode(), and berry::SmartPointer< TObjectType >::IsNull().
Referenced by BlueBerrySelectionChanged(), GetCurrentSelection(), and GetDataManagerSelection().
|
protectedvirtual |
Called when a DataStorage add or remove or change event was thrown. May be reimplemented by deriving classes.
Definition at line 267 of file QmitkFunctionality.cpp.
Referenced by NodeAddedProxy(), NodeChangedProxy(), and NodeRemovedProxy().
|
virtual |
Only called when IsExclusiveFunctionality() returns true.
Definition at line 256 of file QmitkFunctionality.cpp.
Referenced by QmitkFunctionalityCoordinator::DeactivateStandaloneFunctionality().
void QmitkFunctionality::FireNodeSelected | ( | mitk::DataNode * | node | ) |
Informs other parts of the workbench that node is selected via the blueberry selection service.
Definition at line 122 of file QmitkFunctionality2.cpp.
References 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.
Definition at line 129 of file QmitkFunctionality2.cpp.
Referenced by FireNodeSelected().
|
protected |
Returns the default and active StdMultiWidget.
reCreateWidget | a boolean flag to en-/disable the attept to re-create the StdWidget If there is not StdMultiWidget yet a new one is created in this method when called with default parameter! |
Definition at line 272 of file QmitkFunctionality.cpp.
References berry::SmartPointer< TObjectType >::Cast(), GetDataStorageReference(), berry::WorkbenchPart::GetSite(), and berry::IWorkbenchPage::MATCH_ID.
Referenced by AfterCreateQtPartControl().
|
protected |
Definition at line 25 of file QmitkFunctionality2.cpp.
References berry::SmartPointer< TObjectType >::Cast(), DataNodeSelectionToVector(), and berry::WorkbenchPart::GetSite().
|
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
Definition at line 33 of file QmitkFunctionality2.cpp.
References berry::SmartPointer< TObjectType >::Cast(), DataNodeSelectionToVector(), and berry::WorkbenchPart::GetSite().
Referenced by AfterCreateQtPartControl().
|
protected |
Returns the default or the currently active DataStorage if m_HandlesMultipleDataStorages is set to true
Definition at line 66 of file QmitkFunctionality.cpp.
References mitk::IDataStorageService::GetActiveDataStorage(), and mitk::IDataStorageService::GetDefaultDataStorage().
|
protected |
Definition at line 93 of file QmitkFunctionality.cpp.
References mitk::IDataStorageService::GetDataStorage().
Referenced by GetActiveStdMultiWidget().
|
protected |
Definition at line 81 of file QmitkFunctionality.cpp.
References mitk::IDataStorageService::GetDefaultDataStorage().
Referenced by AfterCreateQtPartControl(), and ClosePartProxy().
|
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"
Definition at line 342 of file QmitkFunctionality.cpp.
References berry::Platform::GetPreferencesService(), and berry::IPreferencesService::GetSystemPreferences().
Referenced by AfterCreateQtPartControl(), and ClosePartProxy().
|
protected |
Outputs an error message to the console and displays a message box containing the exception description.
e | the exception which should be handled |
showDialog | controls, whether additionally a message box should be displayed to inform the user that something went wrong |
Definition at line 307 of file QmitkFunctionality.cpp.
|
protected |
Calls HandleException ( std::exception&, QWidget*, bool ) internally
Definition at line 297 of file QmitkFunctionality.cpp.
References MITK_ERROR.
bool QmitkFunctionality::HandlesMultipleDataStorages | ( | ) | const |
Definition at line 60 of file QmitkFunctionality.cpp.
|
virtual |
Called when this functionality is hidden ( no matter what IsExclusiveFunctionality() returns )
Definition at line 355 of file QmitkFunctionality.cpp.
bool QmitkFunctionality::IsActivated | ( | ) | const |
Definition at line 375 of file QmitkFunctionality.cpp.
References m_Active.
Referenced by QmitkFunctionalityCoordinator::ActivateStandaloneFunctionality(), and QmitkFunctionalityCoordinator::DeactivateStandaloneFunctionality().
|
virtual |
Some functionalities need to add special interactors, removes the crosshair from the stdmultiwidget, 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:
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.
Definition at line 360 of file QmitkFunctionality.cpp.
Referenced by QmitkFunctionalityCoordinator::ActivateStandaloneFunctionality().
bool QmitkFunctionality::IsVisible | ( | ) | const |
Definition at line 243 of file QmitkFunctionality.cpp.
References m_Visible.
|
protectedvirtual |
Called when a DataStorage Add event was thrown. May be reimplemented by deriving classes.
Definition at line 83 of file QmitkFunctionality2.cpp.
Referenced by 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.
Definition at line 70 of file QmitkFunctionality2.cpp.
References DataStorageChanged(), and NodeAdded().
Referenced by AfterCreateQtPartControl(), and ClosePartProxy().
|
protectedvirtual |
Called when a DataStorage Changed event was thrown. May be reimplemented by deriving classes.
Definition at line 105 of file QmitkFunctionality2.cpp.
Referenced by 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.
Definition at line 110 of file QmitkFunctionality2.cpp.
References DataStorageChanged(), and NodeChanged().
Referenced by AfterCreateQtPartControl(), and ClosePartProxy().
|
protectedvirtual |
Called when a DataStorage Remove event was thrown. May be reimplemented by deriving classes.
Definition at line 100 of file QmitkFunctionality2.cpp.
Referenced by 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.
Definition at line 88 of file QmitkFunctionality2.cpp.
References DataStorageChanged(), and NodeRemoved().
Referenced by AfterCreateQtPartControl(), and ClosePartProxy().
|
virtual |
Called when the preferences object of this view changed.
Definition at line 228 of file QmitkFunctionality.cpp.
Referenced by AfterCreateQtPartControl(), and ClosePartProxy().
|
virtual |
Called when the selection in the workbench changed
Definition at line 41 of file QmitkFunctionality2.cpp.
Referenced by AfterCreateQtPartControl(), and BlueBerrySelectionChanged().
|
protected |
Convenient method to restore the standard cursor
Definition at line 337 of file QmitkFunctionality.cpp.
Referenced by BusyCursorOff(), and WaitCursorOff().
void QmitkFunctionality::SetActivated | ( | bool | activated | ) |
Toggles the activated flag m_Activated
Definition at line 370 of file QmitkFunctionality.cpp.
References m_Active.
Referenced by QmitkFunctionalityCoordinator::ActivateStandaloneFunctionality(), and QmitkFunctionalityCoordinator::DeactivateStandaloneFunctionality().
|
overridevirtual |
Called when this view receives the focus. Same as Activated()
Implements berry::WorkbenchPart.
Definition at line 248 of file QmitkFunctionality.cpp.
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).
Definition at line 55 of file QmitkFunctionality.cpp.
void QmitkFunctionality::SetVisible | ( | bool | visible | ) |
Toggles the visible flag m_Visible
Definition at line 365 of file QmitkFunctionality.cpp.
References m_Visible.
|
virtual |
Called when a StdMultiWidget is available. Should not be used anymore, see GetActiveStdMultiWidget()
Definition at line 260 of file QmitkFunctionality.cpp.
Referenced by AfterCreateQtPartControl().
|
virtual |
Called when a StdMultiWidget is available. Should not be used anymore, see GetActiveStdMultiWidget()
Definition at line 312 of file QmitkFunctionality.cpp.
|
virtual |
Called when no StdMultiWidget is available anymore. Should not be used anymore, see GetActiveStdMultiWidget()
Definition at line 263 of file QmitkFunctionality.cpp.
|
virtual |
Called when this functionality becomes visible ( no matter what IsExclusiveFunctionality() returns )
Definition at line 350 of file QmitkFunctionality.cpp.
|
protected |
Convenient method to restore the standard cursor
Definition at line 327 of file QmitkFunctionality.cpp.
References RestoreOverrideCursor().
|
protected |
Convenient method to set and reset a wait cursor ("hourglass")
Definition at line 317 of file QmitkFunctionality.cpp.
|
protected |
Saves if this view is the currently active one.
Definition at line 372 of file QmitkFunctionality.h.
Referenced by IsActivated(), and SetActivated().
|
protected |
Saves the parent of this view (this is the scrollarea created in CreatePartControl(QWidget*)
Definition at line 368 of file QmitkFunctionality.h.
Referenced by CreatePartControl().
|
protected |
Saves if this view is visible
Definition at line 376 of file QmitkFunctionality.h.
Referenced by IsVisible(), and SetVisible().