qaddaction - add action to widget
Name
qaddaction — add action to widget
Syntax
qaddaction widget [action]
qaddaction widget name commands
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 QMenuswill have their actions listed as menu items.
Arguments
widget
The target widget to receive the action object. This may be any widget.
action
An instance of qaction
name
The name of the menu item.
commands
Tcl commands to be executed when the user selects the menu item.
Examples
Adding an action to a menu
# 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!" }
See qmainwindow for examples on how to use the qaddaction command. See the qaction command for information on how to create action objects.