Action Class Reference

The Action JavaScript global object. Trigger action associated to menu or tool bar items. More...

Public Slots

void perform (String &slot)
 Perform the requested action (slot - menu item, toolbar item,...) More...
 
void perform (String &slot, String &responder)
 Perform the requested action (slot - menu item, toolbar item,...) More...
 
QVariant validate (String &slot)
 Validate the requested action (slot - menu item, toolbar item,...) More...
 
QVariant validate (String &slot, String &responder)
 Validate the requested action (slot - menu item, toolbar item,...) More...
 

Detailed Description

The Action JavaScript global object. Trigger action associated to menu or tool bar items.

Call either global actions or actions associated to a specific responder.

function callAbout()
{
// Call the global action onActionAbout() which will show the About dialog.
Action.perform("onActionAbout()");
}
function callDisable3DSubnode()
{
// Validate if the action is available right now. In this example, it will fail if no subnode is selected.
if(Action.validate("onActionHideSubNode()", "graph3dresponder").isEnabled)
{
// Call the hide subnode action from the 3D Graph menu (or toolbar).
Action.perform("onActionHideSubNode()", "graph3dresponder");
}
}

Member Function Documentation

◆ perform [1/2]

void Action::perform ( String &  slot)
slot

Perform the requested action (slot - menu item, toolbar item,...)

Perform the requested action for the main application responder. If the main responder doesn't own the requested action, try to use the current view with focus as the responder.

Action.perform("onActionAbout()");
Parameters
slotThe action function name (ex: onMyAction()).

◆ perform [2/2]

void Action::perform ( String &  slot,
String &  responder 
)
slot

Perform the requested action (slot - menu item, toolbar item,...)

Perform the requested action for a specific responder.

Action.perform("onActionToggleApplyToolToAllLayers()", "drawingView");
Parameters
slotThe action function name (ex: onMyAction()).
responderThe responder to the function name (ex: drawingView).

◆ validate [1/2]

QVariant Action::validate ( String &  slot)
slot

Validate the requested action (slot - menu item, toolbar item,...)

Validate the requested action for the main application responder. If the main responder doesn't own the requested action, try to use the current view with focus as the responder.

var validateData = Action.validate("onActionAbout()");
Parameters
slotThe action function name(ex : onMyAction()).
Returns
A script object that has the isValid, enabled and checked boolean properties.

◆ validate [2/2]

QVariant Action::validate ( String &  slot,
String &  responder 
)
slot

Validate the requested action (slot - menu item, toolbar item,...)

Validate the requested action for a specific responder.

// Toggle on the Apply Tool to Line and Colour Art option only if it's off.
var validateData = Action.validate("onActionToggleApplyToolToAllLayers()", "drawingView");
if(!validateData.checked)
Action.perform("onActionToggleApplyToolToAllLayers()", "drawingView");
// Validate that the action "Create New Deformation Chain" is currently executable.
var validateData = Action.validate("onActionCreateNewDeformationChain()", "miniPegModuleResponder");
if(!(validateData.isValid && validateData.enabled))
MessageLog.trace("The desired action is unavailable, please select an element node");
Parameters
slotThe action function name (ex: onMyAction()).
responderThe responder to the function name (ex: drawingView).
Returns
A script object that has the isValid, enabled and checked boolean properties.