Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
|
The QAction class abstracts a user interface action that can appear both in menus and tool bars. More...
#include <qaction.h>
Inherits QObject.
Inherited by Action and QActionGroup.
The QAction class abstracts a user interface action that can appear both in menus and tool bars.
There are two basic kind of user interface actions, command actions and options. QAction usually models a command action, for example "open file". When the actual action shall be performed, it emits the activated() signal. Options, for example the drawing tools in a paint program, are represented by toggle actions (see setToggleAction() ). A toggle action emits a toggled() signal whenever it changes state. Several toggle actions can be combined in a QActionGroup.
To provide an action to the user, use addTo() to add it to either a menu or a tool bar, for example:
QPopupMenu* popup = new QPopupMenu; QAction* myAction= new QAction; myAction->setText( "MyAction" ); myAction->addTo( popup );
You can add an action to an arbitrary number of menus and toolbars and remove it again with removeFrom().
Changing an action's properties, for example using setEnabled(), setOn() or setText(), immediately shows up in all representations. Other properties that define the way an action is presented to the user are iconSet(), menuText(), toolTip(), statusTip() and whatsThis().
An action may also be triggered by an accelerator key declared with setAccel(). Since accelerators are window specific, the application window has to be an ancestor of the action. Generally, it is therefore a good idea to always create actions as direct children of the main window.
If toggle is TRUE, the action becomes a toggle action.
If the parent is a QActionGroup, the action automatically becomes a member of it.
Note: for accelerators to work, the parent or one of its ancestors has to be the application window.
Constructs an action with text text, icon icon, menu text menuText, a keyboard accelerator accel, a parent and name name. text will also show up in tooltips, unless you call setToolTip() with a different tip later.
If the parent is a QActionGroup, the action automatically becomes a member of it.
Note: for accelerators to work, the parent or one of its ancestors has to be the application window.
Constructs an action with text text, menu text menuText, a keyboard accelerator accel, a parent and name name. text will also show up in tooltips, unless you call setToolTip() with a different tip later.
If toggle is TRUE, the action becomes a toggle action.
If the parent is a QActionGroup, the action automatically becomes a member of it.
Note: for accelerators to work, the parent or one of its ancestors has to be the application window.
See also setAccel().
This signal is emitted when the action was activated by the user.
See also toggled().
Currently supported widget types are QToolBar and QPopupMenu.
Returns TRUE when the action was added successfully, FALSE otherwise.
See also removeFrom().
See also setIconSet().
See also setEnabled().
See also setOn() and isToggleAction().
See also setToggleAction().
If no menu text has been defined yet, this is the same as text().
See also setMenuText() and text().
Returns TRUE when the action was removed successfully, FALSE otherwise.
See also addTo().
Note: For accelerators to work, the parent or one of its ancestors has to be the application window.
See also accel().
Menu items and/or tool buttons presenting the action to the user are updated accordingly.
See also isEnabled().
See also iconSet().
See also setText() and menuText().
This function should be called only for toggle actions.
See also isOn() and setToggleAction().
See also statusTip().
See also setMenuText() and text().
You may want to add toggle actions to a QActionGroup for exclusive toggling.
See also isToggleAction().
See also toolTip().
See also whatsThis().
If not status tip has been defined yet, this is the same as toolTip()
See also setStatusTip() and toolTip().
See also setText() and menuText().
This signal is emitted when a toggle action changes state.
See also activated() and setToggleAction().
If no tool tip has been defined yet, it returns text and a hotkey hint.
See also setToolTip() and text().
See also setWhatsThis().
This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|