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

Build a default widget for a given action using its Qt properties. More...

#include <ActionWidget.h>

+ Inheritance diagram for camitk::ActionWidget:
+ Collaboration diagram for camitk::ActionWidget:

Public Slots

void showInfo ()
 show help dialog
 

Public Member Functions

 ActionWidget (Action *)
 create a default action widget for the given action
 
void setApplyButtonText (QString)
 modify the "Apply" button text
 
void setAutoUpdateProperty (bool autoUpdate)
 automatically update the action properties whenever there is a change in the GUI
 
void setButtonVisibility (bool)
 if false then the apply/revert buttons are shown
 
void update ()
 update display (target and property controller)
 
 ~ActionWidget () override
 

Protected Member Functions

QString getTargetLabel ()
 return a text with the target component names followed by their class names
 

Detailed Description

Build a default widget for a given action using its Qt properties.

It should be good enough in most of the case.

The default widget contains:

  • a title with the action icon, name and an information button
  • the parameter ObjectController that allows you to edit/modify all the action parameters
  • apply and revert buttons (the button frame)

The information button shows a dialog with the action classification, a description, the list of parameters and their properties, and the current target component names (inputs),

The button frame contains an "Apply" and a "Revert" button. The Apply button updates the action properties using the value entered by the user in the GUI. I.e., its clicked() signal is connected the the action apply() slot. The revert button resets the values in GUI to the initial values (all modification in the GUI are cancelled). You can easily show or hide the button frame using setButtonVisibility(). You can also customize the "Apply" button text using setApplyButtonText().

update() updates the widget using the actual/current properties and target of the action. This method should be called by an action in the overriden getWidget method. A typical getWidget() method of an action should use the lazy instantiation pattern to instantiate ActionWidget the first time it is called, and call the ActionWidget instance update() method for any subsequent calls.

If you do not want to wait for the user to click on the apply button (or if this button is hidden) and you want the value of the action's property/parameter to be updated everytime there is a change in the GUI, call setAutoUpdateProperty(true) (default is false);

Constructor & Destructor Documentation

◆ ActionWidget()

camitk::ActionWidget::ActionWidget ( Action action)

create a default action widget for the given action

References camitk::ObjectController::BUTTON, camitk::Action::getIcon(), camitk::Action::getName(), camitk::ObjectController::setObject(), and showInfo().

+ Here is the call graph for this function:

◆ ~ActionWidget()

camitk::ActionWidget::~ActionWidget ( )
override

Member Function Documentation

◆ getTargetLabel()

QString camitk::ActionWidget::getTargetLabel ( )
protected

return a text with the target component names followed by their class names

References camitk::Action::getTargets(), and camitk::Application::isAlive().

Referenced by showInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setApplyButtonText()

void camitk::ActionWidget::setApplyButtonText ( QString  text)

modify the "Apply" button text

◆ setAutoUpdateProperty()

void camitk::ActionWidget::setAutoUpdateProperty ( bool  autoUpdate)

automatically update the action properties whenever there is a change in the GUI

References camitk::ObjectController::setAutoUpdateProperty().

+ Here is the call graph for this function:

◆ setButtonVisibility()

void camitk::ActionWidget::setButtonVisibility ( bool  visible)

if false then the apply/revert buttons are shown

Referenced by ActionState::onEntry().

+ Here is the caller graph for this function:

◆ showInfo

void camitk::ActionWidget::showInfo ( )
slot

show help dialog

References description, camitk::Action::getComponentClassName(), camitk::Action::getDescription(), camitk::Action::getFamily(), camitk::Action::getIcon(), camitk::Action::getName(), camitk::Property::getPropertyInformation(), camitk::Action::getTag(), getTargetLabel(), and camitk::toString().

Referenced by ActionWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

void camitk::ActionWidget::update ( )

update display (target and property controller)

References camitk::ObjectController::setObject().

Referenced by ConnectedComponents::apply(), OtsuFilter::apply(), and camitk::CppHotPlugAction::getWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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