Qt Jambi Home

com.trolltech.qt.gui
Class QAction

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by 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:

        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, Application Example

Nested Class Summary
static class QAction.ActionEvent
          This enum type is used when calling QAction.
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<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
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<java.lang.Boolean> toggled
          This signal is emitted whenever a checkable action changes its isChecked status.
 QSignalEmitter.Signal1<java.lang.Boolean> triggered
          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.
 
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<QWidget> associatedWidgets()
          Returns a list of widgets this action has been added to.
 boolean autoRepeat()
          Returns whether the action can auto repeat.
 java.lang.Object data()
          Returns the user data as set in QAction::setData.
 boolean event(QEvent arg__1)
          This function is reimplemented for internal reasons.
 QFont font()
          Returns the action's font.
static QAction fromNativePointer(QNativePointer nativePointer)
          This function returns the QAction instance pointed to by nativePointer
 void hover()
          This is a convenience slot that calls activate(Hover).
 QIcon icon()
          Returns the action's icon.
 java.lang.String iconText()
          Returns the action's descriptive icon text.
 boolean isCheckable()
          Returns whether the action is a checkable action.
 boolean isChecked()
          Returns whether the action is checked..
 boolean isEnabled()
          Returns whether the action is enabled.
 boolean isSeparator()
          Returns true if this action is a separator action; otherwise it returns false.
 boolean isVisible()
          Returns whether the action can be seen (e.g. in menus and toolbars).
 QMenu menu()
          Returns the menu contained by this action.
 QAction.MenuRole menuRole()
          Returns 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)
          Sets whether the action can auto repeat to arg__1.
 void setCheckable(boolean arg__1)
          Sets whether the action is a checkable action to arg__1.
 void setChecked(boolean arg__1)
          Sets whether the action is checked. to arg__1.
 void setData(java.lang.Object var)
          Sets the action's internal data to the given var.
 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)
          Sets whether the action is enabled to arg__1.
 void setFont(QFont font)
          Sets the action's font to font.
 void setIcon(QIcon icon)
          Sets the action's icon to icon.
 void setIcon(QPixmap pm)
          Sets this QAction's icon to pm.
 void setIconText(java.lang.String text)
          Sets the action's descriptive icon text to text.
 void setMenu(QMenu menu)
          Sets the menu contained by this action to the specified menu.
 void setMenuRole(QAction.MenuRole menuRole)
          Sets the action's menu role to menuRole.
 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)
          Sets the action's primary shortcut key to shortcut.
 void setShortcut(java.lang.String key)
          Sets the shortcut to the key sequence for the given key string.
 void setShortcutContext(Qt.ShortcutContext context)
          Sets the context for the action's shortcut to context.
 void setShortcuts(java.util.List<QKeySequence> 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 arg__1.
 void setStatusTip(java.lang.String statusTip)
          Sets the action's status tip to statusTip.
 void setText(java.lang.String text)
          Sets the action's descriptive text to text.
 void setToolTip(java.lang.String tip)
          Sets the action's tooltip to tip.
 void setVisible(boolean arg__1)
          Sets whether the action can be seen (e.g. in menus and toolbars) to arg__1.
 void setWhatsThis(java.lang.String what)
          Sets the action's "What's This?
 QKeySequence shortcut()
          Returns the action's primary shortcut key.
 Qt.ShortcutContext shortcutContext()
          Returns the context for the action's shortcut.
 java.util.List<QKeySequence> shortcuts()
          Returns the list of shortcuts, with the primary shortcut as the first element of the list.
 boolean showStatusText()
          Equivalent to showStatusText(0).
 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()
          Returns the action's status tip.
 java.lang.String text()
          Returns the action's descriptive text.
 void toggle()
          This is a convenience function for the checked property.
 java.lang.String toolTip()
          Returns the action's tooltip.
 void trigger()
          This is a convenience slot that calls activate(Trigger).
 java.lang.String whatsThis()
          Returns the action's "What's This?
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, 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.

Compatible Slot Signature:
void mySlot()
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.

Compatible Slot Signature:
void mySlot()
See Also:
QAction::activate


toggled

public final QSignalEmitter.Signal1<java.lang.Boolean> toggled

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.

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

Compatible Slot Signatures:
void mySlot(boolean arg__1)
void mySlot()
See Also:
QAction::activate, QAction::triggered, checked


triggered

public final QSignalEmitter.Signal1<java.lang.Boolean> triggered

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.

Compatible Slot Signatures:
void mySlot(boolean checked)
void mySlot()
See Also:
QAction::activate, QAction::toggled, 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(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.


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.

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, 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<QWidget> associatedWidgets()

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

See Also:
QWidget::addAction

autoRepeat

public final boolean autoRepeat()

Returns 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.

See Also:
setAutoRepeat

data

public final java.lang.Object data()

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

See Also:
setData

font

public final QFont font()

Returns 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.

See Also:
setFont, QAction::setText, QStyle

hover

public final void hover()

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


icon

public final QIcon icon()

Returns 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.

See Also:
setIcon

iconText

public final java.lang.String iconText()

Returns 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.

There is no default icon text.

See Also:
setIconText, setToolTip, setStatusTip

isCheckable

public final boolean isCheckable()

Returns 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()

Returns 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()

Returns 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.


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()

Returns 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.


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, QMenu::addAction

menuRole

public final QAction.MenuRole menuRole()

Returns 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).

See Also:
setMenuRole

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, QAction::actionGroup

setAutoRepeat

public final void setAutoRepeat(boolean arg__1)

Sets whether the action can auto repeat to arg__1.

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.

See Also:
autoRepeat

setCheckable

public final void setCheckable(boolean arg__1)

Sets whether the action is a checkable action to arg__1.

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:
isCheckable, QAction::setChecked

setChecked

public final void setChecked(boolean arg__1)

Sets whether the action is checked. to arg__1.

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

See Also:
isChecked, checkable

setData

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

Sets the action's internal data to the given var.

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)

Sets whether the action is enabled to arg__1.

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.

See Also:
isEnabled

setFont

public final void setFont(QFont font)

Sets the action's font to 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.

See Also:
font, QAction::setText, QStyle

setIcon

public final void setIcon(QIcon icon)

Sets the action's icon to 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.

See Also:
icon

setIconText

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

Sets the action's descriptive icon text to 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.

There is no default icon text.

See Also:
iconText, setToolTip, setStatusTip

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)

Sets the action's menu role to menuRole.

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).

See Also:
menuRole

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)

Sets the action's primary shortcut key to shortcut.

Valid keycodes for this property can be found in Qt::Key and Qt::Modifier. There is no default shortcut key.

See Also:
shortcut

setShortcutContext

public final void setShortcutContext(Qt.ShortcutContext context)

Sets the context for the action's shortcut to context.

Valid values for this property can be found in Qt::ShortcutContext. The default value is Qt::WindowShortcut.

See Also:
shortcutContext

setShortcuts

public final void setShortcuts(java.util.List<QKeySequence> shortcuts)

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

See Also:
shortcut

setShortcuts

public final void setShortcuts(QKeySequence.StandardKey arg__1)

Sets a platform dependent list of shortcuts based on the arg__1. 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:
shortcuts, QKeySequence::keyBindings

setStatusTip

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

Sets the action's status tip to statusTip.

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

See Also:
statusTip, setToolTip, showStatusText

setText

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

Sets the action's descriptive text to 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:
text, iconText

setToolTip

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

Sets the action's tooltip to tip.

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

See Also:
toolTip, setStatusTip, setShortcut

setVisible

public final void setVisible(boolean arg__1)

Sets whether the action can be seen (e.g. in menus and toolbars) to arg__1.

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.

See Also:
isVisible

setWhatsThis

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

Sets the action's "What's This?" help text to what.

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:
whatsThis, QWhatsThis, Q3StyleSheet

shortcut

public final QKeySequence shortcut()

Returns 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.

See Also:
setShortcut

shortcutContext

public final Qt.ShortcutContext shortcutContext()

Returns the context for the action's shortcut.

Valid values for this property can be found in Qt::ShortcutContext. The default value is Qt::WindowShortcut.

See Also:
setShortcutContext

shortcuts

public final java.util.List<QKeySequence> 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()

Equivalent to showStatusText(0).


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()

Returns the action's status tip.

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

See Also:
setStatusTip, setToolTip, showStatusText

text

public final java.lang.String text()

Returns 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:
setText, 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()

Returns the action's tooltip.

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

See Also:
setToolTip, setStatusTip, setShortcut

trigger

public final void trigger()

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


whatsThis

public final java.lang.String whatsThis()

Returns 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:
setWhatsThis, QWhatsThis, Q3StyleSheet

event

public boolean event(QEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
event in class QObject
See Also:
installEventFilter, timerEvent, QApplication::sendEvent, QApplication::postEvent, QWidget::event

fromNativePointer

public static QAction fromNativePointer(QNativePointer nativePointer)
This function returns the QAction instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

setShortcut

public 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 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 void setIcon(QPixmap pm)
Sets this QAction's icon to pm.


Qt Jambi Home