DAZ Script | |
---|---|
startic | legalizeName ( String name ) |
void | customActionAdded ( String name ) |
void | customActionListChanged () |
void | customActionRemoved ( String name ) |
Responsible for the management of actions that the user can perform in the interface by pressing the key combination specified by its shortcut or by clicking on a menu/toolbar item.
There is only one instance of this manager in an application. This instance is created and owned by DzMainWindow. Request the instance via DzMainWindow::getActionMgr().
See Also:
startic : legalizeName( String name )
Uses the regular expression “([A-z]+[A-z0-9]*)” to strip characters/symbols/etc from a string in order to 'legalize' it.
Parameter(s):
Return Value:
name
.Since:
String : addCustomAction( String text, String desc, String script, Boolean isFile=true, String shortcut=“”, String iconFile=“” )
Adds a custom action to the action manager.
Parameter(s):
script
is assumed to contain a filename, otherwise script
is assumed to be the actual script.Return Value:
void : clearActiveMenu()
Clears the active menu.
DzAction : findAction( String identifier )
Parameter(s):
Return Value:
Example:
var oMgr = MainWindow.getActionMgr(); // Find the 'New File' action and print its accelerator to the log file var oAction = oMgr.findAction( "DzNewAction" ); if( oAction ){ print( oAction.text, ": ", oAction.shortcut ); }
Array : findActionsForShortcut( String shortcut )
Parameter(s):
Return Value:
Example:
(function(){ var oActionMgr = MainWindow.getActionMgr(); var oAction; var aActions = oActionMgr.findActionsForShortcut( "Ctrl+N" ); for( var i = 0, n = aActions.length; i < n; i += 1 ){ oAction = aActions[ i ]; if( oAction.inherits( "DzCustomAction" ) ){ print( i, "Custom:", oAction.name, ":", oAction.shortcut ); } else { print( i, oAction.className(), ":", oAction.shortcut ); } } })();
Since:
Number : findCustomAction( String guid )
Parameter(s):
Return Value:
DzAction : findPaneAction( String identifier )
Parameter(s):
Return Value:
Example:
var oMgr = MainWindow.getActionMgr(); // Find the action for the 'Smart Content' pane and print its accelerator to the log file var oAction = oMgr.findPaneAction( "DzSmartContentPane" ); if( oAction ){ print( oAction.text, ": ", oAction.shortcut ); }
Since:
DzPersistentMenu : findPersistentMenu( String className )
Parameter(s):
Return Value:
DzAction : findViewToolAction( String className )
Parameter(s):
Return Value:
Example:
var oMgr = MainWindow.getActionMgr(); // Find the action for the 'Universal' tool and print its accelerator to the log file var oAction = oMgr.findViewToolAction( "DzUniversalTool" ); if( oAction ){ print( oAction.text, ": ", oAction.shortcut ); }
Since:
DzAction : getAction( Number index )
Parameter(s):
Return Value:
Example:
var oAction; var oMgr = MainWindow.getActionMgr(); // Go through the list of actions and print their accelerators to the log file var nActions = oMgr.getNumActions(); for( var i = 0; i < nActions; i++ ){ oAction = oMgr.getAction( i ); print( oAction.text, ": ", oAction.shortcut ); }
DzActionMenu : getActiveMenu()
Return Value:
Number : getCustomAction( String guid )
Parameter(s):
Return Value:
See Also:
DzAction : getCustomActionByIndex( Number index )
Parameter(s):
Return Value:
Attention:
See Also:
Since:
String : getCustomActionDescription( Number index )
Parameter(s):
Return Value:
Since:
String : getCustomActionFile( Number index )
Parameter(s):
Return Value:
String : getCustomActionIcon( Number index )
Parameter(s):
Return Value:
String : getCustomActionName( Number index )
Parameter(s):
Return Value:
String : getCustomActionScript( Number index )
Parameter(s):
Return Value:
String : getCustomActionShortcut( Number index )
Parameter(s):
Return Value:
Number : getCustomActionShowTextWithIcon( Number index )
Parameter(s):
Return Value:
1
if action text is displayed with the icon for the custom action at index
, 0
if action text is not displayed with the icon, -1
if index
is out of range.Since:
String : getCustomActionText( Number index )
Parameter(s):
Return Value:
String : getDocumentationUrl()
Return Value:
Since:
DzActionMenu : getMenu()
Return Value:
Number : getNumActions()
Return Value:
Number : getNumCustomActions()
Return Value:
Number : getNumPersistentMenus()
Return Value:
DzPersistentMenu : getPersistentMenu( Number index )
Parameter(s):
Return Value:
Boolean : loadInterfaceFile( String filename, Boolean overrideDefaults )
Builds the main menu, pane menus and tool bars from the specified file.
Parameter(s):
Return Value:
true
if the file was successfully loaded, otherwise false
.Since:
void : removeAllCustomActions()
Removes all custom actions from the application.
void : removeCustomAction( Number index )
Removes the custom action at the specified index.
Parameter(s):
Boolean : saveActionsFile( String filename )
Saves the actions to the specified file.
Parameter(s):
Return Value:
true
if the file was saved successfully, otherwise false
.Boolean : saveCustomActionsFile( String filename )
Saves custom actions to the specified file.
Parameter(s):
Return Value:
true
if the file was saved successfully, otherwise false
.Boolean : saveInterfaceFiles()
Saves the actions, menus and toolbars to their respective files in the default location.
Return Value:
true
if the files were saved successfully, otherwise false
.See Also:
Boolean : saveMenusFile( String filename )
Saves the main menu, pane menus, persistent menus, and view tool menus to the specified file.
Parameter(s):
Return Value:
true
if the file was saved successfully, otherwise false
.Boolean : saveToolBarsFile( String filename )
Saves the tool bars to the specified file.
Parameter(s):
Return Value:
true
if the file was saved successfully, otherwise false
.void : setAccel( String className, String key )
Parameter(s):
Example:
var oMgr = MainWindow.getActionMgr(); // Set the accelerator for the 'New File' action to be the 'Ctrl' key and the 'N' key oMgr.setAccel( "DzNewAction", "Ctrl+N" );
void : setActiveMenu( DzActionMenu menu )
Sets the active menu, so that actions relying on the active menu can get it. This may be called before the menu exec() call to allow context for script actions.
Parameter(s):
void : setCustomActionDescription( Number index, String desc )
Sets the description for the custom action at the specified index.
Parameter(s):
Since:
void : setCustomActionIcon( Number index, String iconFile )
Sets the icon for the custom action at the specified index.
Parameter(s):
void : setCustomActionScript( Number index, String script, Boolean isFile=true )
Sets the script for the custom action at the specified index.
Parameter(s):
true
, script contains the name of a script file that should be loaded. If false
, script contains the code for the action's script.void : setCustomActionShortcut( Number index, String shortcut )
Sets the keyboard shortcut for the custom action at the specified index.
Parameter(s):
Since:
void : setCustomActionShowTextWithIcon( Number index, Boolean onOff )
Sets whether the text of the action is displayed with the icon for the custom action at the specified index.
Parameter(s):
true
, the text of the action is always displayed with the icon (e.g., in toolbars).void : setCustomActionText( Number index, String text )
Sets the text for the custom action at the specified index.
Parameter(s):
void : unsetAccel( String key )
Parameter(s):
Example:
var oMgr = MainWindow.getActionMgr(); // Unset the accelerator for the action using 'Control + N' oMgr.unsetAccel( "Ctrl+N" );
void : customActionAdded( String name )
Signature:“customActionAdded(const QString&)”
Emitted when a custom action is added to the action manager.
void : customActionListChanged()
Signature:“customActionListChanged()”
Emitted when custom actions are added to or removed from the action manager.
void : customActionRemoved( String name )
Signature:“customActionRemoved(const QString&)”
Emitted when a custom action is removed from the action manager.