Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Abstract superclass for all custom control widgets of mitk::USDevice classes. More...
#include <QmitkUSAbstractCustomWidget.h>
Public Member Functions | |
QmitkUSAbstractCustomWidget (QWidget *parent=0) | |
virtual | ~QmitkUSAbstractCustomWidget () |
void | SetDevice (mitk::USDevice::Pointer device) |
mitk::USDevice::Pointer | GetDevice () const |
virtual void | OnDeviceSet ()=0 |
Called every time a mitk::USDevice was set with QmitkUSAbstractCustomWidget::SetDevice(). A sublcass can implement this function to handle initialiation actions necessary when a device was set. More... | |
virtual std::string | GetDeviceClass () const =0 |
Subclass must implement this method to return device class of corresponding mitk::USDevice. More... | |
virtual QmitkUSAbstractCustomWidget * | Clone (QWidget *parent=0) const =0 |
Subclass must implement this method to return a pointer to a copy of the object. More... | |
virtual void | Initialize ()=0 |
Method for initializing the Qt stuff of the widget (setupUI, connect). This method will be called in CloneForQt() and has to be implemented by concrete subclasses. More... | |
QmitkUSAbstractCustomWidget * | CloneForQt (QWidget *parent=0) const |
Return pointer to copy of the object. Internally use of QmitkUSAbstractCustomWidget::Clone() with additionaly setting an internal flag that the object was really cloned. More... | |
us::ServiceProperties | GetServiceProperties () const |
Returns the properties of the micro service. Properties consist of just the device class of the corresponding mitk::USDevice. More... | |
void | showEvent (QShowEvent *event) override |
Overwritten Qt even method. It is checked if the object was cloned with QmitkUSAbstractCustomWidget::CloneForQt() before. An exception is thrown if not. This is done, because using the object from micro service directly in Qt without cloning it first can cause problems after Qt deleted the object. More... | |
Static Public Member Functions | |
static std::string | US_DEVICE_PROPKEY_CLASS () |
Property key for the class name of corresponding us device object. More... | |
Abstract superclass for all custom control widgets of mitk::USDevice classes.
The custom control widgets are made available using a us::PrototypeServiceFactory. This means that each concrete subclass should be registered in the microservice by calling QmitkUSAbstractCustomWidget::RegisterService() on an object. The best place for doing this would be in the corresponding module or plugin activator.
Afterwards a copy of the registered object can be obtained from the microservice as shown in the example below. Do not forget to call QmitkUSAbstractCustomWidget::CloneForQt() on the object received from the microservice. This is necessary to allow deleting the object as it is necessary in Qt for removing it from a layout.
Subclasses must implement three methods:
The code to use a custom control widget in a plugin can look like this:
Definition at line 78 of file QmitkUSAbstractCustomWidget.h.
QmitkUSAbstractCustomWidget::QmitkUSAbstractCustomWidget | ( | QWidget * | parent = 0 | ) |
Definition at line 28 of file QmitkUSAbstractCustomWidget.cpp.
|
virtual |
Definition at line 33 of file QmitkUSAbstractCustomWidget.cpp.
|
pure virtual |
Subclass must implement this method to return a pointer to a copy of the object.
Implemented in QmitkUSControlsCustomVideoDeviceWidget.
Referenced by CloneForQt().
QmitkUSAbstractCustomWidget * QmitkUSAbstractCustomWidget::CloneForQt | ( | QWidget * | parent = 0 | ) | const |
Return pointer to copy of the object. Internally use of QmitkUSAbstractCustomWidget::Clone() with additionaly setting an internal flag that the object was really cloned.
Definition at line 50 of file QmitkUSAbstractCustomWidget.cpp.
References Clone(), and Initialize().
mitk::USDevice::Pointer QmitkUSAbstractCustomWidget::GetDevice | ( | ) | const |
Definition at line 45 of file QmitkUSAbstractCustomWidget.cpp.
Referenced by QmitkUSControlsCustomVideoDeviceWidget::Clone(), and QmitkUSControlsCustomVideoDeviceWidget::OnDeviceSet().
|
pure virtual |
Subclass must implement this method to return device class of corresponding mitk::USDevice.
Implemented in QmitkUSControlsCustomVideoDeviceWidget.
Referenced by GetServiceProperties().
us::ServiceProperties QmitkUSAbstractCustomWidget::GetServiceProperties | ( | ) | const |
Returns the properties of the micro service. Properties consist of just the device class of the corresponding mitk::USDevice.
Definition at line 58 of file QmitkUSAbstractCustomWidget.cpp.
References GetDeviceClass(), and US_DEVICE_PROPKEY_CLASS().
Referenced by mitk::USUICustomWidgetFactory::RegisterService().
|
pure virtual |
Method for initializing the Qt stuff of the widget (setupUI, connect). This method will be called in CloneForQt() and has to be implemented by concrete subclasses.
Implemented in QmitkUSControlsCustomVideoDeviceWidget.
Referenced by CloneForQt().
|
pure virtual |
Called every time a mitk::USDevice was set with QmitkUSAbstractCustomWidget::SetDevice(). A sublcass can implement this function to handle initialiation actions necessary when a device was set.
Implemented in QmitkUSControlsCustomVideoDeviceWidget.
Referenced by SetDevice().
void QmitkUSAbstractCustomWidget::SetDevice | ( | mitk::USDevice::Pointer | device | ) |
Definition at line 38 of file QmitkUSAbstractCustomWidget.cpp.
References OnDeviceSet().
Referenced by QmitkUSControlsCustomVideoDeviceWidget::Clone().
|
override |
Overwritten Qt even method. It is checked if the object was cloned with QmitkUSAbstractCustomWidget::CloneForQt() before. An exception is thrown if not. This is done, because using the object from micro service directly in Qt without cloning it first can cause problems after Qt deleted the object.
mitk::Exception |
Definition at line 67 of file QmitkUSAbstractCustomWidget.cpp.
References MITK_ERROR, and mitkThrow.
|
static |
Property key for the class name of corresponding us device object.
Definition at line 22 of file QmitkUSAbstractCustomWidget.cpp.
Referenced by GetServiceProperties().