Computer Assited Medical Intervention Tool Kit  version 4.1
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
camitk::ActionWidget Class Reference

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

#include <ActionWidget.h>

Inherits QFrame.

Public Member Functions

 ActionWidget (Action *)
 create a default action widget for the given action More...
 
void setAutoUpdateProperty (bool autoUpdate)
 automatically update the action properties whenever there is a change in the GUI More...
 
void setButtonVisibility (bool)
 if false then the apply/revert buttons are shown More...
 
void setDescriptionVisibility (bool visible)
 defines whether the description of the widget is visible or not true by default More...
 
void setNameVisibility (bool visible)
 defines whether the name of the widget is visible or not true by default More...
 
void update ()
 update display (target and property controller) More...
 
 ~ActionWidget () override
 

Protected Member Functions

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

Private Attributes

QLabel * actionNameLabel
 the action name displayed in the widget More...
 
QFrame * buttonFrame
 this frame contains the Apply/Revert buttons and can be hide using setButtonVisibility() More...
 
QTextEdit * descriptionTextEdit
 the description of the action displayed in the widget More...
 
ActionmyAction
 the managed action More...
 
ObjectControllerobjectController
 the object controller with the properties of the default widget More...
 
QLabel * targetLabel
 the target list label More...
 

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 description, a reminder of the target component names, and an applyable/revertable ObjectController that allows you to edit/modify properties of the action.

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()

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 instanciation pattern to instanciate ActionWidget the first time it is called, and call the ActionWidget instance update() method for any subsequent calls.

If you cannot 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)

◆ ~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::Component::getName(), camitk::Action::getTargets(), and myAction.

Referenced by ActionWidget(), and update().

◆ setAutoUpdateProperty()

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

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

References objectController, and camitk::ObjectController::setAutoUpdateProperty().

◆ setButtonVisibility()

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

if false then the apply/revert buttons are shown

References buttonFrame.

Referenced by MeshClipping::customizeActionLayout(), and ActionState::onEntry().

◆ setDescriptionVisibility()

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

defines whether the description of the widget is visible or not true by default

References descriptionTextEdit.

◆ setNameVisibility()

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

defines whether the name of the widget is visible or not true by default

References actionNameLabel.

◆ update()

void camitk::ActionWidget::update ( )

update display (target and property controller)

References getTargetLabel(), myAction, objectController, camitk::ObjectController::setObject(), and targetLabel.

Member Data Documentation

◆ actionNameLabel

QLabel* camitk::ActionWidget::actionNameLabel
private

the action name displayed in the widget

Referenced by ActionWidget(), and setNameVisibility().

◆ buttonFrame

QFrame* camitk::ActionWidget::buttonFrame
private

this frame contains the Apply/Revert buttons and can be hide using setButtonVisibility()

Referenced by ActionWidget(), and setButtonVisibility().

◆ descriptionTextEdit

QTextEdit* camitk::ActionWidget::descriptionTextEdit
private

the description of the action displayed in the widget

Referenced by ActionWidget(), and setDescriptionVisibility().

◆ myAction

Action* camitk::ActionWidget::myAction
private

the managed action

Referenced by ActionWidget(), getTargetLabel(), and update().

◆ objectController

ObjectController* camitk::ActionWidget::objectController
private

the object controller with the properties of the default widget

Referenced by ActionWidget(), setAutoUpdateProperty(), and update().

◆ targetLabel

QLabel* camitk::ActionWidget::targetLabel
private

the target list label

Referenced by ActionWidget(), and update().


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