Wiki Markup |
---|
{alias:qaddaction}
h2. Name
*qaddaction* — add action to widget
h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}
*qaddaction* _widget_ \[_action_]
*qaddaction* _widget name commands_
{panel}
h2. Description
The qaddaction command adds a [QAction] object to a widget. Widgets may handle this differently. Instances of [QWidget] will display their actions in a right-click menu, while [QMenus] will have their actions listed as menu items.
h2. Arguments
_widget_
{indent}The target widget to receive the action object. This may be any widget.{indent}
_action_
{indent}An instance of [QAction].{indent}
_name_
{indent}The name of the menu item.{indent}
_commands_
{indent}Tcl commands to be executed when the user selects the menu item.{indent}
{indent}
h2. Examples
h3. Adding an action to a menu
{noformat:|borderWidth=1|bgColor=#eeeeee} |
Name
qaddaction — add action to widget
Syntax
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
qaddaction widget [action] |
Description
The qaddaction command adds a QAction object to a widget. Widgets may handle this differently. Instances of QWidget will display their actions in a right-click menu, while QMenus will have their actions listed as menu items.
Arguments
widget
action
name
commands
Examples
Adding an action to a menu
No Format | ||||
---|---|---|---|---|
| ||||
# Get the Geocap help menu. This could be any menu
set helpmenu [mainwindow helpmenu]
# Add an item named "Hello" to the menu. The commands are the statements found inside the braces.
qaddaction $helpmenu "Hello" { qinformation Hello "Hello there!" }
{noformat}
See [qmainwindow] for examples on how to use the *qaddaction* command. See the [qaction] command for information on how to create action objects.
{pagebreak} |
See qmainwindow for examples on how to use the qaddaction command. See the qaction command for information on how to create action objects.