Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
camitk::HotPlugAction Class Referenceabstract

An Action that can be created on the fly. More...

#include <HotPlugAction.h>

Public Slots

virtual Action::ApplyStatus apply () override=0
 this method is automatically called when the action is triggered.
Public Slots inherited from camitk::Action
virtual camitk::Action::ApplyStatus apply ()=0
 This method is called when the action has to be applied on the target list (get the target lists using getTargets()) It calls the algorithm of your action on the target list of components.
camitk::Action::ApplyStatus applyAndRegister ()
 This method is called whenever the action has to be applied on the target list (like the apply()) method AND registered within the application history of actions.
camitk::Action::ApplyStatus trigger (QWidget *parent=nullptr)
 This method triggers the action.

Public Member Functions

virtual bool event (QEvent *e) override
 manage property change immediately
virtual QWidget * getWidget () override=0
 Calls user-defined targetDefined() and getUI().
 HotPlugAction (HotPlugActionExtension *actionExtension, const VariantDataModel &data)
 Default Constructor.
virtual bool init ()=0
 calls user-defined init()
virtual bool needsUpdate ()
 if this method returns true, update() should be called.
virtual bool update ()
 update the action from the source code.
virtual ~HotPlugAction ()=default
 Default Destructor.
Public Member Functions inherited from camitk::Action
 Action (ActionExtension *)
 Default Constructor: the ActionExtension is needed.
 ~Action () override
 Destructor.
virtual QAction * getQAction (Component *target=nullptr)
 Get the corresponding QAction.
QString getName () const
 get the name of the action
QString getDescription () const
 the description of the action
QString getComponentClassName () const
 the name of the component class that can be used by this action
QString getFamily () const
 the name of the family in which this action is associated
QString getExtensionName () const
 the name of the extension in the family in which this action is associated
QStringList getTag () const
 the name of the tag called this action
bool getEmbedded () const
 argument use to know if the widget is embedded or not
void setDefaultWidgetButtonVisibility (bool)
 if false then the apply/revert buttons are shown
void setDefaultWidgetApplyButtonText (QString)
 modify the "Apply" button text
virtual QPixmap getIcon ()
 the icon to personalize the action (no icon by default)
const ComponentList getTargets () const
 the currently selected and valid (regarding the component property) components, for which this action is called
void updateTargets ()
 update the target list using the currently selected components
bool getAutoUpdateProperties () const
void setAutoUpdateProperties (bool)
 are the properties to be updated every time the user makes a change in the widget (default is false)?
virtual Q_INVOKABLE camitk::PropertygetProperty (QString name)
 Get a Property given its name.
virtual QVariant getParameterValue (const QString &name) const
 get the parameter QVariant (same as property(const char*)) but check if it exists first.
virtual bool setParameterValue (const QString &name, QVariant newValue)
 set the parameter QVariant value (same as setProperty(const char*, newValue)) but check if it exists first.
virtual QString getParameterValueAsString (const QString &name) const
 utility method to get the parameter value as a QString (useful to print the value to log for instance) This method uses Property class to translate the value to a QString
virtual bool addParameter (Property *)
 Add a new parameter to the action, using the CamiTK property class.
virtual QVariant toVariant () const override
virtual void fromVariant (const QVariant &) override
 Load data from a QVariant to initialize the current object.
virtual QUuid getUuid () const override
 Get the unique ID of the action.
virtual bool setUuid (QUuid) override
 Set the unique ID of the action.
ApplyStatus applyInPipeline ()
 This method encapsulates the apply() method.
void setInputComponents (ComponentList inputs)
 Specify the input Component(s) Only applyInPipeline() should be called with this method (maybe apply), but not trigger() as its first intruction is to clear the target components list !
void setInputComponent (Component *input)
 Specify the input Components in case of only one Component.
ComponentList getOutputComponents ()
 Returns the output Component(s).
ComponentgetOutputComponent ()
 Returns the output Components in case of only one Component.
Public Member Functions inherited from camitk::InterfacePersistence
virtual ~InterfacePersistence ()=default

Protected Member Functions

virtual void parameterChangedEvent (QString parameterName)=0
 called when a parameter was changed by an event reimplemented in inherited class
Protected Member Functions inherited from camitk::Action
const ActionExtensiongetExtension () const
 get the extension as const
void refreshApplication ()
 convenient method to call from the user code to refresh all the application This is equivalent to call Application::refresh()
void setName (QString name)
void setDescription (QString description)
 the description of the action
void setComponentClassName (QString componentClassName)
 set the name of the component class that can be used by this action
void setFamily (QString family)
 the name of the family in which this action is associated
void addTag (QString tag)
 add a tag to the tags list of this action
void setEmbedded (bool isEmbedded)
 set the embedded property (an action is embedded by default, unless specified otherwise by explicitly calling this method with false)
void setIcon (QPixmap)
 set the Pixmap

Protected Attributes

HotPlugActionExtensionhotPlugExtension
 where the action is managed
QWidget * actionWidget
 the action widget

Additional Inherited Members

Public Types inherited from camitk::Action
enum  ApplyStatus {
  SUCCESS , ERROR , WARNING , ABORTED ,
  TRIGGERED
}
 describes what happened during the application of an algorithm (i.e. results of the apply method) More...
Static Public Member Functions inherited from camitk::Action
static QString getStatusAsString (ApplyStatus)

Detailed Description

An Action that can be created on the fly.

Constructor & Destructor Documentation

◆ HotPlugAction()

◆ ~HotPlugAction()

virtual camitk::HotPlugAction::~HotPlugAction ( )
virtualdefault

Default Destructor.

Member Function Documentation

◆ apply

virtual Action::ApplyStatus camitk::HotPlugAction::apply ( )
overridepure virtualslot

this method is automatically called when the action is triggered.

Call getTargets() method to get the list of components to use.

Note
getTargets() is automatically filtered so that it only contains compatible components, i.e., instances of "$componentClass$" (or a subclass).

◆ event()

bool camitk::HotPlugAction::event ( QEvent * e)
overridevirtual

manage property change immediately

References parameterChangedEvent().

Referenced by getWidget().

◆ getWidget()

virtual QWidget * camitk::HotPlugAction::getWidget ( )
overridepure virtual

Calls user-defined targetDefined() and getUI().

Reimplemented from camitk::Action.

Implemented in camitk::CppHotPlugAction.

References event(), needsUpdate(), and update().

◆ init()

virtual bool camitk::HotPlugAction::init ( )
pure virtual

calls user-defined init()

Returns
true if the initialization went well

Implemented in camitk::CppHotPlugAction.

◆ needsUpdate()

bool camitk::HotPlugAction::needsUpdate ( )
virtual

if this method returns true, update() should be called.

To be reimplemented in subclass for language (i.e., C++) that needs to watch the user source code

Returns
false unless reimplemented

Reimplemented in camitk::CppHotPlugAction.

Referenced by getWidget().

◆ parameterChangedEvent()

virtual void camitk::HotPlugAction::parameterChangedEvent ( QString parameterName)
protectedpure virtual

called when a parameter was changed by an event reimplemented in inherited class

Implemented in camitk::CppHotPlugAction.

Referenced by event().

◆ update()

bool camitk::HotPlugAction::update ( )
virtual

update the action from the source code.

To be reimplemented in subclass for language (i.e., C++) that needs to watch the user source code and rebuild the code By default does nothing and returns true

Reimplemented in camitk::CppHotPlugAction.

Referenced by getWidget().

Member Data Documentation

◆ hotPlugExtension

HotPlugActionExtension* camitk::HotPlugAction::hotPlugExtension
protected

where the action is managed

Referenced by HotPlugAction(), and camitk::CppHotPlugAction::update().


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