|
QCAD Application Framework
CAD Application Development and Automation.
|
Abstract base class for GUI action classes. More...
#include <RGuiAction.h>
Public Types | |
| typedef void(* | FactoryFunction )() |
Public Slots | |
| bool | slotTrigger (const QString &command=QString::null) |
| Called when the action is triggered (e.g. | |
Signals | |
| void | postTriggered () |
Public Member Functions | |
| void | addArgument (const QString &arg) |
| void | addToMenu (QMenu *menu) |
| void | addToToolBar (QToolBar *tb) |
| void | addToWidget (QWidget *w) |
| void | disableIcon () |
| QStringList | getArguments () |
| QStringList | getCommands () |
| QStringList | getDefaultCommands () |
| QList< QKeySequence > | getDefaultShortcuts () |
| RDocumentInterface * | getDocumentInterface () |
| QString | getGroup () |
| QString | getMainCommand () |
| bool | getRequiresDocument () |
| bool | getRequiresRedoableTransaction () |
| bool | getRequiresSelection () |
| bool | getRequiresUndoableTransaction () |
| QString | getScriptFile () |
| QString | getShortcutText () |
| int | getSortOrder () |
| QString | getToolTip (const QString &text, const QString &shortcut) |
| QString | getUniqueGroup () |
| bool | hasNoState () |
| virtual void | initTexts () |
| Initializes the GUI action texts (for menus, tooltips, ...). | |
| virtual bool | isChecked () |
| bool | isGroupDefault () |
| bool | isIconDisabled () |
| bool | isOverride () |
| RGuiAction (const QString &text, QObject *parent=0) | |
| virtual void | setChecked (bool on) |
| Checks or unchecks this action. | |
| void | setCommands (const QStringList &cmds) |
| Sets the command(s) that can trigger this action from a command line. | |
| void | setDefaultCommands (const QStringList &cmds) |
| void | setDefaultShortcut (const QKeySequence &shortcut) |
| void | setDefaultShortcuts (const QList< QKeySequence > &shortcuts) |
| void | setDocumentInterface (RDocumentInterface *di) |
| virtual void | setEnabled (bool on) |
| Enables or disables the action. | |
| virtual void | setEnabledOverride (bool on, int override) |
| Enables or disables the action. | |
| void | setFactory (FactoryFunction f) |
| virtual void | setGroup (const QString &title) |
| void | setGroupDefault (bool on) |
| virtual void | setIcon (const QString &iconFile) |
| Sets the action icon to the given icon file. | |
| void | setNoState (bool checkable=false) |
| void | setOverride () |
| void | setRequiresDocument (bool on) |
If on is true, this action requires a document to be open. | |
| void | setRequiresRedoableTransaction (bool on) |
| void | setRequiresSelection (bool on) |
If on is true, this action requires a selection to operate on. | |
| void | setRequiresUndoableTransaction (bool on) |
| void | setScriptFile (const QString &sf, bool isSecondary=false) |
| Sets the script file to be used for this action. | |
| void | setShortcut (const QKeySequence &shortcut) |
| Sets the shortcut(s) for this action. | |
| void | setShortcuts (const QList< QKeySequence > &shortcuts) |
| void | setShortcutText (const QString &text) |
| void | setSortOrder (int sortOrder) |
| virtual void | setStatusTip (const QString &tip) |
| Sets the status tip of this action. | |
| virtual void | setToolTip (const QString &tip) |
| Sets the tooltip for this action. | |
| void | setUniqueGroup (const QString &ug) |
| virtual void | updateFocus (RDocumentInterface *documentInterface) |
| Called by the document whenever the focus changed from one MDI to another. | |
| virtual void | updateSelectionListener (RDocumentInterface *documentInterface) |
| Called by the document whenever the current clipboard changes. | |
| virtual void | updateTransactionListener (const RDocument *document) |
| Called by the document whenever the current transaction stack changes. | |
| virtual | ~RGuiAction () |
Public Member Functions inherited from RFocusListener | |
| virtual | ~RFocusListener () |
Public Member Functions inherited from RTransactionListener | |
| virtual | ~RTransactionListener () |
Public Member Functions inherited from RSelectionListener | |
| virtual | ~RSelectionListener () |
Static Public Member Functions | |
| static void | clear () |
| Cleans up all GUI action objects. | |
| static QString | formatToolTip (const QString &text, const QString &shortcut) |
| static QList< RGuiAction * > | getActions () |
| static QStringList | getAvailableCommands (bool primaryOnly=false) |
| static QStringList | getAvailableCommands (const QString &start, bool primaryOnly=false) |
| static RGuiAction * | getByScriptFile (const QString &scriptFile) |
| static bool | triggerByCommand (const QString &cmd) |
| Triggers the first action in the list of actions that is registered to use the given command. | |
| static bool | triggerByScriptFile (const QString &scriptFile) |
Triggers the first action in the list of actions that is based on the given scriptFile. | |
| static void | triggerGroupDefault (const QString &group) |
| static void | triggerGroupDefaults () |
Protected Attributes | |
| QStringList | arguments |
| QStringList | commandList |
| QStringList | defaultCommandList |
| QList< QKeySequence > | defaultShortcuts |
| RDocumentInterface * | documentInterface |
| int | enabledOverride |
| FactoryFunction | factory |
| QString | group |
| bool | groupDefault |
| bool | iconDisabled |
| QString | mainCommand |
| bool | noState |
| bool | override |
| bool | requiresDocument |
| bool | requiresRedoableTransaction |
| bool | requiresSelection |
| bool | requiresUndoableTransaction |
| QString | scriptFile |
| QString | shortcutText |
| int | sortOrder |
| QString | toolTip |
| QString | uniqueGroup |
Static Protected Attributes | |
| static QList< RGuiAction * > | actions |
| static QMap< QString, RGuiAction * > | actionsByCommand |
| static QMultiMap< QString, RGuiAction * > | actionsByGroup |
| static QMap< QString, RGuiAction * > | actionsByPrimaryCommand |
| static QMap< QString, RGuiAction * > | actionsByScriptFile |
Abstract base class for GUI action classes.
Such classes represent a GUI action that can be used to start a tool. One GUI action class may be assigned to multiple GUI elements, for example a menu, a toolbutton and a context menu.
Each GUI action can have multiple commands assigned to it. These commands can be used to trigger the action from a command line.
Each GUI action can have multiple shortcuts assigned to it. Shortcuts are 'traditional' key combinations that can be used to trigger the action. e.g. Ctrl + Z, Ctrl + N, ...
| typedef void(* RGuiAction::FactoryFunction)() |
| RGuiAction::RGuiAction | ( | const QString & | text, |
| QObject * | parent = 0 |
||
| ) |
|
virtual |
| void RGuiAction::addArgument | ( | const QString & | arg | ) |
| void RGuiAction::addToMenu | ( | QMenu * | menu | ) |
| void RGuiAction::addToToolBar | ( | QToolBar * | tb | ) |
| void RGuiAction::addToWidget | ( | QWidget * | w | ) |
|
static |
Cleans up all GUI action objects.
| void RGuiAction::disableIcon | ( | ) |
|
static |
|
inlinestatic |
| QStringList RGuiAction::getArguments | ( | ) |
|
static |
| primaryOnly | True: only include primary commands (e.g. 'point') False: also include secondary commands (e.g. 'po') |
|
static |
start.This is typically used when the user presses the Tab key in a command line to complete a started command. For example entering "li<tab>" will result in the command to be completed to "line".
| primaryOnly | True: only include primary commands (e.g. 'point') False: also include secondary commands (e.g. 'po') |
|
static |
scriptFile.
|
inline |
|
inline |
| QList< QKeySequence > RGuiAction::getDefaultShortcuts | ( | ) |
| RDocumentInterface * RGuiAction::getDocumentInterface | ( | ) |
| QString RGuiAction::getGroup | ( | ) |
|
inline |
|
inline |
| true | This action requires an open document to be started. |
| false | This action does not require an open document to be started. |
|
inline |
|
inline |
| true | This action requires an selection to be started. |
| false | This action does not require a selection to be started. |
|
inline |
|
inline |
| QString RGuiAction::getShortcutText | ( | ) |
| int RGuiAction::getSortOrder | ( | ) |
| QString RGuiAction::getToolTip | ( | const QString & | text, |
| const QString & | shortcut | ||
| ) |
|
inline |
|
inline |
|
virtual |
Initializes the GUI action texts (for menus, tooltips, ...).
This function is called whenever the text of the action changes.
|
virtual |
| bool RGuiAction::isGroupDefault | ( | ) |
| bool RGuiAction::isIconDisabled | ( | ) |
|
inline |
|
signal |
|
virtual |
Checks or unchecks this action.
| void RGuiAction::setCommands | ( | const QStringList & | cmds | ) |
Sets the command(s) that can trigger this action from a command line.
| cmd | Comma separated list of command(s) to set for this action. e.g. "mycommand", "mycommand,mycom,mc". |
| void RGuiAction::setDefaultCommands | ( | const QStringList & | cmds | ) |
| void RGuiAction::setDefaultShortcut | ( | const QKeySequence & | shortcut | ) |
| void RGuiAction::setDefaultShortcuts | ( | const QList< QKeySequence > & | shortcuts | ) |
| void RGuiAction::setDocumentInterface | ( | RDocumentInterface * | di | ) |
|
virtual |
Enables or disables the action.
|
virtual |
Enables or disables the action.
| override | -1: don't set override (default), 1: true, 0: false |
| void RGuiAction::setFactory | ( | FactoryFunction | f | ) |
\par Non-Scriptable:
This function is not available in script environments.
|
virtual |
| void RGuiAction::setGroupDefault | ( | bool | on | ) |
|
virtual |
Sets the action icon to the given icon file.
|
inline |
|
inline |
|
inline |
If on is true, this action requires a document to be open.
The GUI element(s) can for example be grayed out if no document is open.
|
inline |
|
inline |
If on is true, this action requires a selection to operate on.
The GUI element(s) can for example be grayed out if no selection is present.
|
inline |
| void RGuiAction::setScriptFile | ( | const QString & | sf, |
| bool | isSecondary = false |
||
| ) |
Sets the script file to be used for this action.
This is only used for script based actions.
| isSecondary | true to avoid this action to be identified by the given script file when calling getByScriptFile. Used for example for recent file menu entries which all refer to the script OpenFile.js. |
| void RGuiAction::setShortcut | ( | const QKeySequence & | shortcut | ) |
Sets the shortcut(s) for this action.
| shortcut | Comma separated list of shortcuts (e.g. "Ctrl-Shift-Z,Ctrl-Y"). |
| void RGuiAction::setShortcuts | ( | const QList< QKeySequence > & | shortcuts | ) |
| void RGuiAction::setShortcutText | ( | const QString & | text | ) |
| void RGuiAction::setSortOrder | ( | int | sortOrder | ) |
|
virtual |
Sets the status tip of this action.
The status tip is shown in the status bar of the application when the mouse cursor hovers of a menu entry.
|
virtual |
Sets the tooltip for this action.
Tooltips are shown when the mouse cursor hovers over a GUI element for some time.
|
inline |
|
slot |
Called when the action is triggered (e.g.
This should be called when the action is triggered, i.e.
a button is pressed or a menu chosen).
a GUI element is activated (button pressed, menu selected, etc).
|
static |
Triggers the first action in the list of actions that is registered to use the given command.
| command | Command that was launched (e.g. "line" or "ln"). |
|
static |
Triggers the first action in the list of actions that is based on the given scriptFile.
|
static |
found &&
|
static |
|
virtual |
Called by the document whenever the focus changed from one MDI to another.
| di | The document interface that has now the focus. |
Implements RFocusListener.
|
virtual |
Called by the document whenever the current clipboard changes.
Implements RSelectionListener.
|
virtual |
Called by the document whenever the current transaction stack changes.
Implements RTransactionListener.
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |