#include <cmdinstance.h>
Public Slots | |
| void | cmdSelectionChanged (CmdTreeNode *cmd) |
Signals | |
| void | cmdInstanceChanged (CmdInstance *instance) |
| void | cmdEnabledStatusChanged (CmdInstance *instance) |
| void | cmdParamChanged (CmdInstance *instance) |
| void | varInstanceCreated (CmdInstance *instance, VarInstance *varInst) |
Public Member Functions | |
| CmdInstance (CmdTreeNode *cmd=NULL, bool autoInitParams=true) | |
| CmdInstance (CmdTreeNode *cmd, const QStringList ¶mValues) | |
| ~CmdInstance () | |
| CmdTreeNode * | cmd () |
| const QStringList & | paramValues () const |
| const QMap< uint, VarInstance * > & | externVarsMap () const |
| bool | isEnabled () const |
| void | setCmd (CmdTreeNode *cmd, bool autoInitParams=true) |
| void | setParamValues (const QStringList ¶mValues) |
| void | setEnabled (bool enable) |
| void | exec () const |
| void | initParamValues () |
| QString | toString () const |
| void | updateParamValues () |
| QHBox * | createEditorWidget (QWidget *parent) |
| QHBox * | getEditorWidget () |
| void | setCmdSelector (CmdSelector *selector) |
| CmdSelector * | cmdSelectoror () const |
| void | setEditorBackgroundColour (const QColor &colour) |
| void | updateParamWidgets () |
Private Slots | |
| void | cmdSelectorClicked () |
| void | cmdEnableCheckBoxToggled (bool on) |
| void | paramValueChanged () |
| void | editorWidgetCleanup () |
Private Member Functions | |
| void | sharedInit () |
| void | createParamWidgets () |
Private Attributes | |
| CmdTreeNode * | myCmd |
| QStringList | myParamValues |
| bool | myEnabledStatus |
| QMap< uint, VarInstance * > | myExternVarsMap |
| CmdSelector * | myCmdSelector |
| QHBox * | cmdEditorBox |
| QCheckBox * | cmdEnabledCheckBox |
| QLabel * | cmdSpacerLabel |
| QPushButton * | cmdSelectorButton |
| QLabel * | cmdOpenBraceLabel |
| QLabel * | cmdCloseBraceLabel |
| QHBox * | cmdParamsBox |
| QPtrList< QWidget > | cmdParamWidgets |
Note: There is a QtMac (Q_OS_MACX) specific section in the CmdInstance::setEditorBackgroundColour() method.
Note: If you want to be able to make a CmdInstance::createEditorWidget() call, then you will need to make a CmdInstance::setCmdSelector() call first. Though, this only needs to be done once.
|
||||||||||||
|
Default constructor, which gives the ability to initialize the parameters to the command's defaults. |
|
||||||||||||
|
Constructor, which allow you to specify a list of parameters. Assumption: The paramValues contains the correct number of values. |
|
|
Destructor. Deallocate any external variables that the command instance used. |
|
|
|
|
|
This method updates the command instance's enabled status. This includes updating the private myEnabledStatus variable and enabling/disabling the editor widgets (bar the cmdEnabledCheckbox of course). It also emits the cmdEnabledStatusChanged signal. |
|
|
|
|
|
|
|
|
|
|
|
Change the command item for a given table command row. It also emits the cmdInstanceChanged signal just before it returns. Precondition: myCmdSelector != 0 and cmd != 0. |
|
|
Called when the command selection button is toggled. This is connected to QPushButton's toggled( bool on ) signal. Precondition: myCmdSelector != 0. |
|
|
|
|
|
Create an instance of an editor for THIS command instance. Note: You need to ensure that you have made a CmdInstance::setCmdSelector() call first before calling this method. Without doing this, the method will simply return NULL without doing anything. Though, this only needs to be done once. Note: Only one editor can exist at once, as the command selector is SHARED. |
|
|
Create the paremeter widgets and insert them into a container widget. This is called by createEditorWidget and cmdSelectionChanged. NOTE! This is designed for indernal use only. NOTE! This will delete any existing parameter widgets first. The widgets are inserted into cmdParamsBox. |
|
|
This method cleans up this command instance when it editor is destroyed. This is called by cmdEditorBox's destroyed signal. |
|
|
Execute the command instance, using the current command and the current parameters. Note: The command instance will NOT execute if it has been disabled using the CmdInstance::setEnabled() method. |
|
|
|
|
|
|
|
|
Initialize the parameters to the defaults that are specified by the command. If myCmd is NULL, then this will NOT do anything (we don't know the formal parameters). Note: This has to be done AFTER myExternVarsMap is created! Otherwise if a parameter uses an array, their values will not be appended. |
|
|
|
|
|
Called when one of the parameter input widget's value is changed. It also emits the cmdParamChanged signal just before it returns. |
|
|
|
|
||||||||||||
|
Set the command tree command prototype node for the instance. Note: This will return straight away if cmd = 0. Note: This destroys existing external variables and creates new ones for the given command. In the case where new external variables are created, a varInstanceCreated will be emitted for each one. |
|
|
|
|
|
Set the background colour of the editor, that is if it is active. Note: There is a QtMac (Q_OS_MACX) specific section in this method. It is used to set colours appropiately for specific widgets. |
|
|
|
|
|
|
|
|
This method is used by the constructors to perform tasks that are common to all of them. |
|
|
Get a string representation of the command instanance (including its params). |
|
|
Update that myParamValues string value list using values from both the parameter widgets and the element widgets of arrays that being to parameters. Note: An editor does NOT need to be active for this method to be useful. For example, this can be called when an external variable that belongs to one of this instance's parameter's is updated. |
|
|
This is used to update the values of the parameter widgets in an existing and active command instance editor (for this instance). It is particularly useful if you want to change the name of a variable and then need the change to be reflected by the command instance editor. |
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.3.2