Difference between revisions of "Views Without Multi Widget"

From mitk.org
Jump to navigation Jump to search
 
Line 35: Line 35:
 
| mitk::DataStorage::Pointer GetDefaultDataStorage()
 
| mitk::DataStorage::Pointer GetDefaultDataStorage()
 
| mitk::DataStorage::Pointer GetDataStorage()
 
| mitk::DataStorage::Pointer GetDataStorage()
 +
|-
 +
| bool IsActivated()
 +
| x (remeber the state yourself by implementing the mitk::ILifecycleAwarePart interface)
 +
|-
 +
| QmitkStdMultiWidget* GetActiveStdMultiWidget(bool reCreateWidget = true)
 +
| mitk::IRenderWindowPart* GetRenderWindowPart(IRenderWindowPartStrategies)
 +
|-
 +
| m_Parent
 +
|  x (remember the parent yourself in CreateQtPartControl(QWidget*) )
 +
|-
 +
| bool IsExclusiveFunctionality()
 +
| x (implement the mitk::IZombieViewPart interface to indicate special behavior)
 
|}
 
|}
  
Line 42: Line 54:
 
|-
 
|-
 
| void StdMultiWidgetAvailable(QmitkStdMultiWidget&)
 
| void StdMultiWidgetAvailable(QmitkStdMultiWidget&)
| void IRenderWindowPartActivated(mitk::IRenderWindowPart*)
+
| void RenderWindowPartActivated(mitk::IRenderWindowPart*)
 
|}
 
|}
  
Line 53: Line 65:
 
| '''QmitkFunctionality'''
 
| '''QmitkFunctionality'''
 
| '''mitk::IZombieViewPart'''
 
| '''mitk::IZombieViewPart'''
 +
|-
 +
| void Deactivated()
 +
| void ActivatedZombieView(berry::IWorkbenchPartReference::Pointer)
 +
|}
 +
 +
Calls to the global mitk::RenderingManager instance should be replaced by calls to the mitk::IRenderingManager instance returned by the mitk::IRenderWindowPart. Rendering update requests should be done by calling QmitkAbstractView::[[RequestRenderWindowUpdate]].
 +
 +
<pre><nowiki>#!highlight cpp
 +
// Get a mitk::IRenderingManager instance
 +
mitk::IRenderingManager* rendering manager =
 +
  this->GetRenderWindowPart()->GetRenderingManager();
 +
 +
// Request an update of the currently active render windows
 +
this->RequestRenderWindowUpdate();
 +
</nowiki></pre>

Revision as of 14:02, 19 February 2012

Replace the QmitkFunctionality inheritance of your View class with QmitkAbstractView and remove any QmitkStdMultiWidget.h include directives.


#!highlight cpp
//#include <QmitkStdMultiWidget.h> <-- Remove this include
//#include <QmitkFunctionality.h> <-- Remove this include
#include <QmitkAbstractView.h>

//class MyView : public QmitkFunctionality {...};
class MyView : public QmitkAbstractView {...};


You must implement the method SetFocus(). Previously, an empty default implementation was provided by QmitkFunctionality which generally is not a good default.


#!highlight cpp
void SetFocus()
{
  m_Controls->someWidget->setFocus();
}


The following table maps the deprecated QmitkFunctionality API to the new API offered by QmitkAbstractView or related interfaces.

QmitkFunctionality QmitkAbstractView
void OnSelectionChanged(std::vector<mitk::DataNode*>) void OnSelectionChanged(berry::IWorkbenchPart::Pointer, const QList<mitk::DataNode::Pointer>&)
mitk::DataStorage::Pointer GetDefaultDataStorage() mitk::DataStorage::Pointer GetDataStorage()
bool IsActivated() x (remeber the state yourself by implementing the mitk::ILifecycleAwarePart interface)
QmitkStdMultiWidget* GetActiveStdMultiWidget(bool reCreateWidget = true) mitk::IRenderWindowPart* GetRenderWindowPart(IRenderWindowPartStrategies)
m_Parent x (remember the parent yourself in CreateQtPartControl(QWidget*) )
bool IsExclusiveFunctionality() x (implement the mitk::IZombieViewPart interface to indicate special behavior)
QmitkFunctionality mitk::IRenderWindowPartListener
void StdMultiWidgetAvailable(QmitkStdMultiWidget&) void RenderWindowPartActivated(mitk::IRenderWindowPart*)
QmitkFunctionality mitk::ILifecycleAwarePart
QmitkFunctionality mitk::IZombieViewPart
void Deactivated() void ActivatedZombieView(berry::IWorkbenchPartReference::Pointer)

Calls to the global mitk::RenderingManager instance should be replaced by calls to the mitk::IRenderingManager instance returned by the mitk::IRenderWindowPart. Rendering update requests should be done by calling QmitkAbstractView::RequestRenderWindowUpdate.

#!highlight cpp
// Get a mitk::IRenderingManager instance
mitk::IRenderingManager* rendering manager =
  this->GetRenderWindowPart()->GetRenderingManager();

// Request an update of the currently active render windows
this->RequestRenderWindowUpdate();