Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QAction

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QAction

All Implemented Interfaces:
  QtJambiInterface

Direct Known Subclasses:
  QWidgetAction

    public class QAction

extends QObject

The QAction class provides an abstract user interface action that can be inserted into widgets. In applications many common commands can be invoked via menus, toolbar buttons, and keyboard shortcuts. Since the user expects each command to be performed in the same way, regardless of the user interface used, it is useful to represent each command as an action.

Actions can be added to menus and toolbars, and will automatically keep them in sync. For example, in a word processor, if the user presses a Bold toolbar button, the Bold menu item will automatically be checked.

Actions can be created as independent objects, but they may also be created during the construction of menus; the `QMenu` class contains convenience functions for creating actions suitable for use as menu items.

A QAction may contain an icon, menu text, a shortcut, status text, "What's This?" text, and a tooltip. Most of these can be set in the constructor. They can also be set independently with `setIcon()`, `setText()`, `setIconText()`, `setShortcut()`, `setStatusTip()`, `setWhatsThis()`, and `setToolTip()`. For menu items, it is possible to set an individual font with `setFont()`.

Actions are added to widgets using `QWidget::addAction()`. Note that an action must be added to a widget before it can be used; this is also true when the shortcut should be global (i.e., `Qt::ApplicationShortcut` as `Qt::ShortcutContext` ).

Once a QAction has been created it should be added to the relevant menu and toolbar, then connected to the slot which will perform the action. For example:
The following code example is written in c++.

        openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
        openAct->setShortcut(tr("Ctrl+O"));
        openAct->setStatusTip(tr("Open an existing file"));
        connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

        fileMenu->addAction(openAct);

        fileToolBar->addAction(openAct);

We recommend that actions are created as children of the window they are used in. In most cases actions will be children of the application's main window.

See also:
  `QMenu`, `QToolBar`, and Application Example.

Nested Class Summary
`static class` | `QAction.ActionEvent` This enum type is used when calling `QAction::activate()`
`static class` | `QAction.MenuRole` This enum describes how an action should be moved into the application menu on Mac OS X.

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary
`QSignalEmitter.Signal0` | `changed` This signal is emitted when an action has changed.
`QSignalEmitter.Signal0` | `hovered` This signal is emitted when an action is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.
`QSignalEmitter.Signal1` | `toggled` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `triggered` This signal takes 1 generic argument(s).

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QAction(QIcon icon, java.lang.String text, QObject parent)` Constructs an action with an `icon` and some `text` and `parent`.
`QAction(QObject parent)` Constructs an action with `parent`.
`QAction(java.lang.String text, QObject parent)` Constructs an action with some `text` and `parent`.

Method Summary
`QActionGroup` | `actionGroup()` Returns the action group for this action.
`void` | `activate(QAction.ActionEvent event)` Sends the relevant signals for `ActionEvent` `event`.
`java.util.List` | `associatedWidgets()` Returns a list of widgets this action has been added to.
`boolean` | `autoRepeat()` This property holds whether the action can auto repeat.
`java.lang.Object` | `data()` Returns the user data as set in QAction.:setData.
`QFont` | `font()` This property holds the action's font.
`void` | `hover()` This is a convenience slot that calls activate(Hover).
`QIcon` | `icon()` This property holds the action's icon.
`java.lang.String` | `iconText()` This property holds the action's descriptive icon text.
`boolean` | `isCheckable()` This property holds whether the action is a checkable action.
`boolean` | `isChecked()` This property holds whether the action is checked.
`boolean` | `isEnabled()` This property holds whether the action is enabled.
`boolean` | `isIconVisibleInMenu()` This property holds Whether or not an action should show an icon in a menu.
`boolean` | `isSeparator()` Returns true if this action is a separator action; otherwise it returns false.
`boolean` | `isVisible()` This property holds whether the action can be seen (e.g.
`QMenu` | `menu()` Returns the menu contained by this action.
`QAction.MenuRole` | `menuRole()` This property holds the action's menu role.
`QWidget` | `parentWidget()` Returns the parent widget.
`void` | `setActionGroup(QActionGroup group)` Sets this action group to `group`.
`void` | `setAutoRepeat(boolean arg__1)` This property holds whether the action can auto repeat.
`void` | `setCheckable(boolean arg__1)` This property holds whether the action is a checkable action.
`void` | `setChecked(boolean arg__1)` This property holds whether the action is checked.
`void` | `setData(java.lang.Object var)` Sets the action's internal data to the given `userData`.
`void` | `setDisabled(boolean b)` This is a convenience function for the `enabled` property, that is useful for signals--slots connections.
`void` | `setEnabled(boolean arg__1)` This property holds whether the action is enabled.
`void` | `setFont(QFont font)` This property holds the action's font.
`void` | `setIcon(QIcon icon)` This property holds the action's icon.
`void` | `setIcon(QPixmap pm)`
`void` | `setIconText(java.lang.String text)` This property holds the action's descriptive icon text.
`void` | `setIconVisibleInMenu(boolean visible)` This property holds Whether or not an action should show an icon in a menu.
`void` | `setMenu(QMenu menu)` Sets the menu contained by this action to the specified `menu`.
`void` | `setMenuRole(QAction.MenuRole menuRole)` This property holds the action's menu role.
`void` | `setSeparator(boolean b)` If `b` is true then this action will be considered a separator.
`void` | `setShortcut(QKeySequence.StandardKey key)` Sets the shortcut to the key sequence for the given key.
`void` | `setShortcut(QKeySequence shortcut)` This property holds the action's primary shortcut key.
`void` | `setShortcut(java.lang.String key)` Sets the shortcut to the key sequence for the given key string.
`void` | `setShortcutContext(Qt.ShortcutContext context)` This property holds the context for the action's shortcut.
`void` | `setShortcuts(java.util.List shortcuts)` Sets `shortcuts` as the list of shortcuts that trigger the action.
`void` | `setShortcuts(QKeySequence.StandardKey arg__1)` Sets a platform dependent list of shortcuts based on the `key`.
`void` | `setStatusTip(java.lang.String statusTip)` This property holds the action's status tip.
`void` | `setText(java.lang.String text)` This property holds the action's descriptive text.
`void` | `setToolTip(java.lang.String tip)` This property holds the action's tooltip.
`void` | `setVisible(boolean arg__1)` This property holds whether the action can be seen (e.g.
`void` | `setWhatsThis(java.lang.String what)` This property holds the action's "What's This?" help text.
`QKeySequence` | `shortcut()` This property holds the action's primary shortcut key.
`Qt.ShortcutContext` | `shortcutContext()` This property holds the context for the action's shortcut.
`java.util.List` | `shortcuts()` Returns the list of shortcuts, with the primary shortcut as the first element of the list.
`boolean` | `showStatusText()` Updates the relevant status bar for the `widget` specified by sending a `QStatusTipEvent` to its parent widget.
`boolean` | `showStatusText(QWidget widget)` Updates the relevant status bar for the `widget` specified by sending a `QStatusTipEvent` to its parent widget.
`java.lang.String` | `statusTip()` This property holds the action's status tip.
`java.lang.String` | `text()` This property holds the action's descriptive text.
`void` | `toggle()` This is a convenience function for the `checked` property.
`java.lang.String` | `toolTip()` This property holds the action's tooltip.
`void` | `trigger()` This is a convenience slot that calls activate(Trigger).
`java.lang.String` | `whatsThis()` This property holds the action's "What's This?" help text.

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### changed

    public final QSignalEmitter.Signal0 changed

  This signal is emitted when an action has changed. If you are only interested in actions in a given widget, you can watch for `QWidget::actionEvent()` sent with an `QEvent::ActionChanged` .

See also:
  `QWidget::actionEvent()`.

### hovered

    public final QSignalEmitter.Signal0 hovered

  This signal is emitted when an action is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.

See also:
  `QAction::activate()`.

### toggled

    public final QSignalEmitter.Signal1 toggled

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Boolean(named: checked)>:

  This signal is emitted whenever a checkable action changes its `isChecked()` status. This can be the result of a user interaction, or because `setChecked()` was called.

  `checked` is true if the action is checked, or false if the action is unchecked.

See also:
  `QAction::activate()`, `QAction::triggered()` , and `checked`.

### triggered

    public final QSignalEmitter.Signal1 triggered

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Boolean(named: checked)>:

  This signal is emitted when an action is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination, or when `trigger()` was called. Notably, it is not emitted when `setChecked()` or `toggle()` is called.

  If the action is checkable, `checked` is true if the action is checked, or false if the action is unchecked.

See also:
  `QAction::activate()`, `QAction::toggled()` , and `checked`.

Constructor Detail

### QAction

    public QAction(QObject parent)

  Constructs an action with `parent`. If `parent` is an action group the action will be automatically inserted into the group.

### QAction

    public QAction(QIcon icon,
                   java.lang.String text,
                   QObject parent)

  Constructs an action with an `icon` and some `text` and `parent`. If `parent` is an action group the action will be automatically inserted into the group.

  The action uses a stripped version of `text` (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with `setText()`. The same text will be used for tooltips unless you specify a different text using `setToolTip()`.

### QAction

    public QAction(java.lang.String text,
                   QObject parent)

  Constructs an action with some `text` and `parent`. If `parent` is an action group the action will be automatically inserted into the group.

  The action uses a stripped version of `text` (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with `setText()`. The same text will be used for tooltips unless you specify a different text using `setToolTip()`.

Method Detail

### actionGroup

    public final QActionGroup actionGroup()

  Returns the action group for this action. If no action group manages this action then 0 will be returned.

See also:
  `QActionGroup`, and `QAction::setActionGroup()`.

### activate

    public final void activate(QAction.ActionEvent event)

  Sends the relevant signals for `ActionEvent` `event`.

  Action based widgets use this API to cause the QAction to emit signals as well as emitting their own.

### associatedWidgets

    public final java.util.List associatedWidgets()

  Returns a list of widgets this action has been added to.

See also:
  `QWidget::addAction()`.

### autoRepeat

    public final boolean autoRepeat()

  This property holds whether the action can auto repeat. If true, the action will auto repeat when the keyboard shortcut combination is held down, provided that keyboard auto repeat is enabled on the system. The default value is true.

### data

    public final java.lang.Object data()

  Returns the user data as set in QAction.:setData.

See also:
  `setData()`.

### font

    public final QFont font()

  This property holds the action's font. The font property is used to render the text set on the QAction. The font will can be considered a hint as it will not be consulted in all cases based upon application and style.

  By default, this property contains the application's default font.

See also:
  `QAction::setText()`, and `QStyle`.

### hover

    public final void hover()

  This is a convenience slot that calls activate(Hover).

### icon

    public final QIcon icon()

  This property holds the action's icon. In toolbars, the icon is used as the tool button icon; in menus, it is displayed to the left of the menu text. There is no default icon.

  If a null icon (`QIcon::isNull()` is passed into this function, the icon of the action is cleared.

### iconText

    public final java.lang.String iconText()

  This property holds the action's descriptive icon text. If `QToolBar::toolButtonStyle` is set to a value that permits text to be displayed, the text defined held in this property appears as a label in the relevant tool button.

  It also serves as the default text in menus and tooltips if the action has not been defined with `setText()` or `setToolTip()`, and will also be used in toolbar buttons if no icon has been defined using `setIcon()`.

  If the icon text is not explicitly set, the action's normal text will be used for the icon text.

  By default, this property contains an empty string.

See also:
  `setToolTip()`, and `setStatusTip()`.

### isCheckable

    public final boolean isCheckable()

  This property holds whether the action is a checkable action. A checkable action is one which has an on/off state. For example, in a word processor, a Bold toolbar button may be either on or off. An action which is not a toggle action is a command action; a command action is simply executed, e.g. file save. By default, this property is false.

  In some situations, the state of one toggle action should depend on the state of others. For example, "Left Align", "Center" and "Right Align" toggle actions are mutually exclusive. To achieve exclusive toggling, add the relevant toggle actions to a `QActionGroup` with the `QActionGroup::exclusive` property set to true.

See also:
  `QAction::setChecked()`.

### isChecked

    public final boolean isChecked()

  This property holds whether the action is checked. Only checkable actions can be checked. By default, this is false (the action is unchecked).

See also:
  `checkable`.

### isEnabled

    public final boolean isEnabled()

  This property holds whether the action is enabled. Disabled actions cannot be chosen by the user. They do not disappear from menus or toolbars, but they are displayed in a way which indicates that they are unavailable. For example, they might be displayed using only shades of gray.

  What's This? help on disabled actions is still available, provided that the `QAction::whatsThis` property is set.

  By default, this property is true (actions are enabled).

See also:
  `text`.

### isIconVisibleInMenu

    public final boolean isIconVisibleInMenu()

  This property holds Whether or not an action should show an icon in a menu. In some applications, it may make sense to have actions with icons in the toolbar, but not in menus. If true, the icon (if valid) is shown in the menu, when it is false, it is not shown.

  The default is to follow whether the `Qt::AA_DontShowIconsInMenus` attribute is set for the application. Explicitly settings this property overrides the presence (or abscence) of the attribute.

  For example:

          QApplication.initialize(args);
          QApplication.setAttribute(Qt.ApplicationAttribute.AA_DontShowIconsInMenus);  // Icons are *no longer shown* in menus
          // ...
          QAction myAction = new QAction(window);
          // ...
          myAction.setIcon(SomeIcon);
          myAction.setIconVisibleInMenu(true);   // Icon *will* be shown in menus for *this* action.

See also:
  `QAction::icon`, and `QApplication::setAttribute()`.

### isSeparator

    public final boolean isSeparator()

  Returns true if this action is a separator action; otherwise it returns false.

See also:
  `QAction::setSeparator()`.

### isVisible

    public final boolean isVisible()

  This property holds whether the action can be seen (e.g. in menus and toolbars). If visible is true the action can be seen (e.g. in menus and toolbars) and chosen by the user; if visible is false the action cannot be seen or chosen by the user.

  Actions which are not visible are not grayed out; they do not appear at all.

  By default, this property is true (actions are visible).

### menu

    public final QMenu menu()

  Returns the menu contained by this action. Actions that contain menus can be used to create menu items with submenus, or inserted into toolbars to create buttons with popup menus.

See also:
  `setMenu()`, and `QMenu::addAction()`.

### menuRole

    public final QAction.MenuRole menuRole()

  This property holds the action's menu role. This indicates what role the action serves in the application menu on Mac OS X. By default all action have the `TextHeuristicRole` , which means that the action is added based on its text (see `QMenuBar` for more information).

  The menu role can only be changed before the actions are put into the menu bar in Mac OS X (usually just before the first application window is shown).

### parentWidget

    public final QWidget parentWidget()

  Returns the parent widget.

### setActionGroup

    public final void setActionGroup(QActionGroup group)

  Sets this action group to `group`. The action will be automatically added to the group's list of actions.

  Actions within the group will be mutually exclusive.

See also:
  `QActionGroup`, and `QAction::actionGroup()`.

### setAutoRepeat

    public final void setAutoRepeat(boolean arg__1)

  This property holds whether the action can auto repeat. If true, the action will auto repeat when the keyboard shortcut combination is held down, provided that keyboard auto repeat is enabled on the system. The default value is true.

### setCheckable

    public final void setCheckable(boolean arg__1)

  This property holds whether the action is a checkable action. A checkable action is one which has an on/off state. For example, in a word processor, a Bold toolbar button may be either on or off. An action which is not a toggle action is a command action; a command action is simply executed, e.g. file save. By default, this property is false.

  In some situations, the state of one toggle action should depend on the state of others. For example, "Left Align", "Center" and "Right Align" toggle actions are mutually exclusive. To achieve exclusive toggling, add the relevant toggle actions to a `QActionGroup` with the `QActionGroup::exclusive` property set to true.

See also:
  `QAction::setChecked()`.

### setChecked

    public final void setChecked(boolean arg__1)

  This property holds whether the action is checked. Only checkable actions can be checked. By default, this is false (the action is unchecked).

See also:
  `checkable`.

### setData

    public final void setData(java.lang.Object var)

  Sets the action's internal data to the given `userData`.

See also:
  `data()`.

### setDisabled

    public final void setDisabled(boolean b)

  This is a convenience function for the `enabled` property, that is useful for signals--slots connections. If `b` is true the action is disabled; otherwise it is enabled.

### setEnabled

    public final void setEnabled(boolean arg__1)

  This property holds whether the action is enabled. Disabled actions cannot be chosen by the user. They do not disappear from menus or toolbars, but they are displayed in a way which indicates that they are unavailable. For example, they might be displayed using only shades of gray.

  What's This? help on disabled actions is still available, provided that the `QAction::whatsThis` property is set.

  By default, this property is true (actions are enabled).

See also:
  `text`.

### setFont

    public final void setFont(QFont font)

  This property holds the action's font. The font property is used to render the text set on the QAction. The font will can be considered a hint as it will not be consulted in all cases based upon application and style.

  By default, this property contains the application's default font.

See also:
  `QAction::setText()`, and `QStyle`.

### setIcon

    public final void setIcon(QIcon icon)

  This property holds the action's icon. In toolbars, the icon is used as the tool button icon; in menus, it is displayed to the left of the menu text. There is no default icon.

  If a null icon (`QIcon::isNull()` is passed into this function, the icon of the action is cleared.

### setIconText

    public final void setIconText(java.lang.String text)

  This property holds the action's descriptive icon text. If `QToolBar::toolButtonStyle` is set to a value that permits text to be displayed, the text defined held in this property appears as a label in the relevant tool button.

  It also serves as the default text in menus and tooltips if the action has not been defined with `setText()` or `setToolTip()`, and will also be used in toolbar buttons if no icon has been defined using `setIcon()`.

  If the icon text is not explicitly set, the action's normal text will be used for the icon text.

  By default, this property contains an empty string.

See also:
  `setToolTip()`, and `setStatusTip()`.

### setIconVisibleInMenu

    public final void setIconVisibleInMenu(boolean visible)

  This property holds Whether or not an action should show an icon in a menu. In some applications, it may make sense to have actions with icons in the toolbar, but not in menus. If true, the icon (if valid) is shown in the menu, when it is false, it is not shown.

  The default is to follow whether the `Qt::AA_DontShowIconsInMenus` attribute is set for the application. Explicitly settings this property overrides the presence (or abscence) of the attribute.

  For example:

          QApplication.initialize(args);
          QApplication.setAttribute(Qt.ApplicationAttribute.AA_DontShowIconsInMenus);  // Icons are *no longer shown* in menus
          // ...
          QAction myAction = new QAction(window);
          // ...
          myAction.setIcon(SomeIcon);
          myAction.setIconVisibleInMenu(true);   // Icon *will* be shown in menus for *this* action.

See also:
  `QAction::icon`, and `QApplication::setAttribute()`.

### setMenu

    public final void setMenu(QMenu menu)

  Sets the menu contained by this action to the specified `menu`.

See also:
  `menu()`.

### setMenuRole

    public final void setMenuRole(QAction.MenuRole menuRole)

  This property holds the action's menu role. This indicates what role the action serves in the application menu on Mac OS X. By default all action have the `TextHeuristicRole` , which means that the action is added based on its text (see `QMenuBar` for more information).

  The menu role can only be changed before the actions are put into the menu bar in Mac OS X (usually just before the first application window is shown).

### setSeparator

    public final void setSeparator(boolean b)

  If `b` is true then this action will be considered a separator.

  How a separator is represented depends on the widget it is inserted into. Under most circumstances the text, submenu, and icon will be ignored for separator actions.

See also:
  `QAction::isSeparator()`.

### setShortcut

    public final void setShortcut(QKeySequence shortcut)

  This property holds the action's primary shortcut key. Valid keycodes for this property can be found in `Qt::Key` and `Qt::Modifier` . There is no default shortcut key.

### setShortcutContext

    public final void setShortcutContext(Qt.ShortcutContext context)

  This property holds the context for the action's shortcut. Valid values for this property can be found in `Qt::ShortcutContext` . The default value is `Qt::WindowShortcut` .

### setShortcuts

    public final void setShortcuts(QKeySequence.StandardKey arg__1)

  Sets a platform dependent list of shortcuts based on the `key`. The result of calling this function will depend on the currently running platform. Note that more than one shortcut can assigned by this action. If only the primary shortcut is required, use setShortcut instead.

See also:
  `QKeySequence::keyBindings()`.

### setShortcuts

    public final void setShortcuts(java.util.List shortcuts)

  Sets `shortcuts` as the list of shortcuts that trigger the action. The first element of the list is the primary shortcut.

See also:
  `shortcuts()`, and `shortcut`.

### setStatusTip

    public final void setStatusTip(java.lang.String statusTip)

  This property holds the action's status tip. The status tip is displayed on all status bars provided by the action's top-level parent widget.

  By default, this property contains an empty string.

See also:
  `setToolTip()`, and `showStatusText()`.

### setText

    public final void setText(java.lang.String text)

  This property holds the action's descriptive text. If the action is added to a menu, the menu option will consist of the icon (if there is one), the text, and the shortcut (if there is one). If the text is not explicitly set in the constructor, or by using `setText()`, the action's description icon text will be used as text. There is no default text.

See also:
  `iconText`.

### setToolTip

    public final void setToolTip(java.lang.String tip)

  This property holds the action's tooltip. This text is used for the tooltip. If no tooltip is specified, the action's text is used.

  By default, this property contains the action's text.

See also:
  `setStatusTip()`, and `setShortcut()`.

### setVisible

    public final void setVisible(boolean arg__1)

  This property holds whether the action can be seen (e.g. in menus and toolbars). If visible is true the action can be seen (e.g. in menus and toolbars) and chosen by the user; if visible is false the action cannot be seen or chosen by the user.

  Actions which are not visible are not grayed out; they do not appear at all.

  By default, this property is true (actions are visible).

### setWhatsThis

    public final void setWhatsThis(java.lang.String what)

  This property holds the action's "What's This?" help text. The "What's This?" text is used to provide a brief description of the action. The text may contain rich text. There is no default "What's This?" text.

See also:
  `QWhatsThis`, and Q3StyleSheet.

### shortcut

    public final QKeySequence shortcut()

  This property holds the action's primary shortcut key. Valid keycodes for this property can be found in `Qt::Key` and `Qt::Modifier` . There is no default shortcut key.

### shortcutContext

    public final Qt.ShortcutContext shortcutContext()

  This property holds the context for the action's shortcut. Valid values for this property can be found in `Qt::ShortcutContext` . The default value is `Qt::WindowShortcut` .

### shortcuts

    public final java.util.List shortcuts()

  Returns the list of shortcuts, with the primary shortcut as the first element of the list.

See also:
  `setShortcuts()`.

### showStatusText

    public final boolean showStatusText()

  Updates the relevant status bar for the `widget` specified by sending a `QStatusTipEvent` to its parent widget. Returns true if an event was sent; otherwise returns false.

  If a null widget is specified, the event is sent to the action's parent.

See also:
  `statusTip`.

### showStatusText

    public final boolean showStatusText(QWidget widget)

  Updates the relevant status bar for the `widget` specified by sending a `QStatusTipEvent` to its parent widget. Returns true if an event was sent; otherwise returns false.

  If a null widget is specified, the event is sent to the action's parent.

See also:
  `statusTip`.

### statusTip

    public final java.lang.String statusTip()

  This property holds the action's status tip. The status tip is displayed on all status bars provided by the action's top-level parent widget.

  By default, this property contains an empty string.

See also:
  `setToolTip()`, and `showStatusText()`.

### text

    public final java.lang.String text()

  This property holds the action's descriptive text. If the action is added to a menu, the menu option will consist of the icon (if there is one), the text, and the shortcut (if there is one). If the text is not explicitly set in the constructor, or by using `setText()`, the action's description icon text will be used as text. There is no default text.

See also:
  `iconText`.

### toggle

    public final void toggle()

  This is a convenience function for the `checked` property. Connect to it to change the checked state to its opposite state.

### toolTip

    public final java.lang.String toolTip()

  This property holds the action's tooltip. This text is used for the tooltip. If no tooltip is specified, the action's text is used.

  By default, this property contains the action's text.

See also:
  `setStatusTip()`, and `setShortcut()`.

### trigger

    public final void trigger()

  This is a convenience slot that calls activate(Trigger).

### whatsThis

    public final java.lang.String whatsThis()

  This property holds the action's "What's This?" help text. The "What's This?" text is used to provide a brief description of the action. The text may contain rich text. There is no default "What's This?" text.

See also:
  `QWhatsThis`, and Q3StyleSheet.

### setShortcut

    public final void setShortcut(java.lang.String key)

  Sets the shortcut to the key sequence for the given key string. For example "Ctrl+O" gives CTRL+'O'. The strings "Ctrl", "Shift", "Alt" and "Meta" are recognized, as well as their translated equivalents in the "QShortcut" context (using QObject::tr()). Up to four key codes may be entered by separating them with commas, e.g. "Alt+X,Ctrl+S,Q".

  Parameters:
    `key` - The description of the key sequence. Typically used with tr() so key sequences can be locale aware.

### setShortcut

    public final void setShortcut(QKeySequence.StandardKey key)

  Sets the shortcut to the key sequence for the given key. The result will depend on the currently running platform. The key sequence will be based on the first element in the list of key bindings for the key.

  Parameters:
    `key` - The key for which to select a key sequence

### setIcon

    public final void setIcon(QPixmap pm)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD