Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:qaddaction}

Name

qaddaction — add action to widget

...

The qaddaction command adds a QAction object qaction object to a widget. Widgets may handle this differently. Instances of QWidget will qwidget will display their actions in a right-click menu, while QMenus will 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

No Format
bgColor#eeeeee
borderWidth1

# 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!" }

...