.TH "KAction" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KAction \- Class to encapsulate user-driven action or event.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kaction.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
Inherited by \fBKActionMenu\fP, KActionSeparator, \fBKDataToolAction\fP, \fBKPasteTextAction\fP, \fBKSelectAction\fP, \fBKToggleAction\fP, \fBKToolBarPopupAction\fP, and \fBKWidgetAction\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBActivationReason\fP { \fBUnknownActivation\fP, \fBEmulatedActivation\fP, \fBAccelActivation\fP, \fBPopupMenuActivation\fP, \fBToolBarActivation\fP }"
.br
.in -1c
.SS "Public Slots"

.in +1c
.ti -1c
.RI "virtual void \fBsetText\fP (const \fBQString\fP &text)"
.br
.ti -1c
.RI "virtual bool \fBsetShortcut\fP (const \fBKShortcut\fP &)"
.br
.ti -1c
.RI "virtual void \fBsetGroup\fP (const \fBQString\fP &)"
.br
.ti -1c
.RI "virtual void \fBsetWhatsThis\fP (const \fBQString\fP &text)"
.br
.ti -1c
.RI "virtual void \fBsetToolTip\fP (const \fBQString\fP &)"
.br
.ti -1c
.RI "virtual void \fBsetIconSet\fP (const \fBQIconSet\fP &iconSet)"
.br
.ti -1c
.RI "virtual void \fBsetIcon\fP (const \fBQString\fP &icon)"
.br
.ti -1c
.RI "virtual void \fBsetEnabled\fP (bool enable)"
.br
.ti -1c
.RI "virtual void \fBsetShortcutConfigurable\fP (bool)"
.br
.ti -1c
.RI "virtual void \fBactivate\fP ()"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBactivated\fP ()"
.br
.ti -1c
.RI "void \fBactivated\fP (\fBKAction::ActivationReason\fP reason, Qt::ButtonState state)"
.br
.ti -1c
.RI "void \fBenabled\fP (bool)"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBKShortcut\fP &cut, const \fBQObject\fP *receiver, const char *slot, \fBKActionCollection\fP *\fBparent\fP, const char *\fBname\fP)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBQIconSet\fP &pix, const \fBKShortcut\fP &cut, const \fBQObject\fP *receiver, const char *slot, \fBKActionCollection\fP *\fBparent\fP, const char *\fBname\fP)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBQString\fP &pix, const \fBKShortcut\fP &cut, const \fBQObject\fP *receiver, const char *slot, \fBKActionCollection\fP *\fBparent\fP, const char *\fBname\fP)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBKGuiItem\fP &item, const \fBKShortcut\fP &cut, const \fBQObject\fP *receiver, const char *slot, \fBKActionCollection\fP *\fBparent\fP, const char *\fBname\fP)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBKShortcut\fP &cut=\fBKShortcut\fP(), \fBQObject\fP *\fBparent\fP=0, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBKShortcut\fP &cut, const \fBQObject\fP *receiver, const char *slot, \fBQObject\fP *\fBparent\fP, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBQIconSet\fP &pix, const \fBKShortcut\fP &cut=\fBKShortcut\fP(), \fBQObject\fP *\fBparent\fP=0, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBQString\fP &pix, const \fBKShortcut\fP &cut=\fBKShortcut\fP(), \fBQObject\fP *\fBparent\fP=0, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBQIconSet\fP &pix, const \fBKShortcut\fP &cut, const \fBQObject\fP *receiver, const char *slot, \fBQObject\fP *\fBparent\fP, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "\fBKAction\fP (const \fBQString\fP &text, const \fBQString\fP &pix, const \fBKShortcut\fP &cut, const \fBQObject\fP *receiver, const char *slot, \fBQObject\fP *\fBparent\fP, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "\fBKAction\fP (\fBQObject\fP *\fBparent\fP=0, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "virtual \fB~KAction\fP ()"
.br
.ti -1c
.RI "virtual int \fBplug\fP (\fBQWidget\fP *widget, int index=-1)"
.br
.ti -1c
.RI "virtual void \fBplugAccel\fP (\fBKAccel\fP *accel, bool configurable=true) KDE_DEPRECATED"
.br
.ti -1c
.RI "virtual void \fBunplug\fP (\fBQWidget\fP *w)"
.br
.ti -1c
.RI "virtual void \fBunplugAccel\fP () KDE_DEPRECATED"
.br
.ti -1c
.RI "virtual bool \fBisPlugged\fP () const "
.br
.ti -1c
.RI "bool \fBisPlugged\fP (const \fBQWidget\fP *container) const "
.br
.ti -1c
.RI "virtual bool \fBisPlugged\fP (const \fBQWidget\fP *container, int id) const "
.br
.ti -1c
.RI "virtual bool \fBisPlugged\fP (const \fBQWidget\fP *container, const \fBQWidget\fP *_representative) const "
.br
.ti -1c
.RI "\fBQWidget\fP * \fBcontainer\fP (int index) const "
.br
.ti -1c
.RI "int \fBitemId\fP (int index) const "
.br
.ti -1c
.RI "\fBQWidget\fP * \fBrepresentative\fP (int index) const "
.br
.ti -1c
.RI "int \fBcontainerCount\fP () const "
.br
.ti -1c
.RI "uint \fBkaccelCount\fP () const "
.br
.ti -1c
.RI "virtual bool \fBhasIcon\fP () const "
.br
.ti -1c
.RI "bool \fBhasIconSet\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBplainText\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBtext\fP () const "
.br
.ti -1c
.RI "virtual const \fBKShortcut\fP & \fBshortcut\fP () const "
.br
.ti -1c
.RI "virtual const \fBKShortcut\fP & \fBshortcutDefault\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBshortcutText\fP () const "
.br
.ti -1c
.RI "void \fBsetShortcutText\fP (const \fBQString\fP &)"
.br
.ti -1c
.RI "virtual bool \fBisEnabled\fP () const "
.br
.ti -1c
.RI "virtual bool \fBisShortcutConfigurable\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBgroup\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBwhatsThis\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBtoolTip\fP () const "
.br
.ti -1c
.RI "virtual \fBQIconSet\fP \fBiconSet\fP (\fBKIcon::Group\fP group, int size=0) const "
.br
.ti -1c
.RI "\fBQIconSet\fP \fBiconSet\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBicon\fP () const "
.br
.ti -1c
.RI "\fBKActionCollection\fP * \fBparentCollection\fP () const "
.br
.ti -1c
.RI "void \fBunplugAll\fP ()"
.br
.ti -1c
.RI "int \fBaccel\fP () const KDE_DEPRECATED"
.br
.ti -1c
.RI "\fBQString\fP \fBstatusText\fP () const "
.br
.ti -1c
.RI "void \fBsetAccel\fP (int key) KDE_DEPRECATED"
.br
.ti -1c
.RI "void \fBsetStatusText\fP (const \fBQString\fP &text)"
.br
.ti -1c
.RI "int \fBmenuId\fP (int i)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static int \fBgetToolButtonID\fP ()"
.br
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "virtual void \fBslotDestroyed\fP ()"
.br
.ti -1c
.RI "virtual void \fBslotKeycodeChanged\fP ()"
.br
.ti -1c
.RI "virtual void \fBslotActivated\fP ()"
.br
.ti -1c
.RI "void \fBslotPopupActivated\fP ()"
.br
.ti -1c
.RI "void \fBslotButtonClicked\fP (int, Qt::ButtonState state)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "\fBKToolBar\fP * \fBtoolBar\fP (int index) const "
.br
.ti -1c
.RI "\fBQPopupMenu\fP * \fBpopupMenu\fP (int index) const "
.br
.ti -1c
.RI "void \fBremoveContainer\fP (int index)"
.br
.ti -1c
.RI "int \fBfindContainer\fP (const \fBQWidget\fP *widget) const "
.br
.ti -1c
.RI "int \fBfindContainer\fP (int id) const "
.br
.ti -1c
.RI "void \fBplugMainWindowAccel\fP (\fBQWidget\fP *w)"
.br
.ti -1c
.RI "void \fBaddContainer\fP (\fBQWidget\fP *\fBparent\fP, int id)"
.br
.ti -1c
.RI "void \fBaddContainer\fP (\fBQWidget\fP *\fBparent\fP, \fBQWidget\fP *representative)"
.br
.ti -1c
.RI "virtual void \fBupdateShortcut\fP (int i)"
.br
.ti -1c
.RI "virtual void \fBupdateShortcut\fP (\fBQPopupMenu\fP *menu, int id)"
.br
.ti -1c
.RI "virtual void \fBupdateGroup\fP (int id)"
.br
.ti -1c
.RI "virtual void \fBupdateText\fP (int i)"
.br
.ti -1c
.RI "virtual void \fBupdateEnabled\fP (int i)"
.br
.ti -1c
.RI "virtual void \fBupdateIconSet\fP (int i)"
.br
.ti -1c
.RI "virtual void \fBupdateIcon\fP (int i)"
.br
.ti -1c
.RI "virtual void \fBupdateToolTip\fP (int id)"
.br
.ti -1c
.RI "virtual void \fBupdateWhatsThis\fP (int i)"
.br
.ti -1c
.RI "\fBQString\fP \fBwhatsThisWithIcon\fP () const "
.br
.ti -1c
.RI "const \fBKGuiItem\fP & \fBguiItem\fP () const "
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "\fBKActionCollection\fP * \fBm_parentCollection\fP"
.br
.in -1c
.SS "Properties"

.in +1c
.ti -1c
.RI "int \fBcontainerCount\fP"
.br
.ti -1c
.RI "\fBQString\fP \fBplainText\fP"
.br
.ti -1c
.RI "\fBQString\fP \fBtext\fP"
.br
.ti -1c
.RI "\fBQString\fP \fBshortcut\fP"
.br
.ti -1c
.RI "bool \fBenabled\fP"
.br
.ti -1c
.RI "\fBQString\fP \fBgroup\fP"
.br
.ti -1c
.RI "\fBQString\fP \fBwhatsThis\fP"
.br
.ti -1c
.RI "\fBQString\fP \fBtoolTip\fP"
.br
.ti -1c
.RI "\fBQString\fP \fBicon\fP"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKActionCollection\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
Class to encapsulate user-driven action or event. 

The KAction class (and derived and super classes) provides a way to easily encapsulate a 'real' user-selected action or event in your program.
.PP
For instance, a user may want to \fCpaste\fP the contents of the clipboard or \fCscroll\fP \fCdown\fP a document or \fCquit\fP the application. These are all \fCactions\fP -- events that the user causes to happen. The KAction class allows the developer to deal with these actions in an easy and intuitive manner.
.PP
Specifically, the KAction class encapsulated the various attributes to an event/action. For instance, an action might have an icon that goes along with it (a clipboard for a 'paste' action or scissors for a 'cut' action). The action might have some text to describe the action. It will certainly have a method or function that actually \fCexecutes\fP the action! All these attributes are contained within the KAction object.
.PP
The advantage of dealing with Actions is that you can manipulate the Action without regard to the GUI representation of it. For instance, in the 'normal' way of dealing with actions like 'cut', you would manually insert a item for Cut into a menu and a button into a toolbar. If you want to disable the cut action for a moment (maybe nothing is selected), you would have to hunt down the pointer to the menu item and the toolbar button and disable both individually. Setting the menu item and toolbar item up uses very similar code - but has to be done twice!
.PP
With the Action concept, you simply 'plug' the Action into whatever GUI element you want. The KAction class will then take care of correctly defining the menu item (with icons, accelerators, text, etc) or toolbar button.. or whatever. From then on, if you manipulate the Action at all, the effect will propogate through all GUI representations of it. Back to the 'cut' example: if you want to disable the Cut Action, you would simply do 'cutAction->setEnabled(false)' and the menuitem and button would instantly be disabled!
.PP
This is the biggest advantage to the Action concept -- there is a one-to-one relationship between the 'real' action and \fCall\fP GUI representations of it.
.PP
KAction emits the \fBactivated()\fP signal if the user activated the corresponding GUI element ( menu item, toolbar button, etc. )
.PP
If you are in the situation of wanting to map the \fBactivated()\fP signal of multiple action objects to one slot, with a special argument bound to each action, then you might consider using \fBQSignalMapper\fP . A tiny example:
.PP
.PP
.nf
 QSignalMapper *desktopNumberMapper = new QSignalMapper( this );
 connect( desktopNumberMapper, SIGNAL( mapped( int ) ),
          this, SLOT( moveWindowToDesktop( int ) ) );

 for ( uint i = 0; i < numberOfDesktops; ++i ) {
     KAction *desktopAction = new KAction( i18n( 'Move Window to Desktop %i' ).arg( i ), ... );
     connect( desktopAction, SIGNAL( activated() ), desktopNumberMapper, SLOT( map() ) );
     desktopNumberMapper->setMapping( desktopAction, i );
 }
.fi
.PP
.PP
\fBGeneral Usage:\fP
.br
.PP
The steps to using actions are roughly as follows
.PP
.PD 0
.IP "\(bu" 2
Decide which attributes you want to associate with a given action (icons, text, keyboard shortcut, etc) 
.IP "\(bu" 2
Create the action using KAction (or derived or super class). 
.IP "\(bu" 2
'Plug' the Action into whatever GUI element you want. Typically, this will be a menu or toolbar.
.PP
\fBDetailed Example:\fP
.br
.PP
Here is an example of enabling a 'New [document]' action 
.PP
.nf
 KAction *newAct = new KAction(i18n('&New'), 'filenew',
                               KStdAccel::shortcut(KStdAccel::New),
                               this, SLOT(fileNew()),
                               actionCollection(), 'new');

.fi
.PP
 This line creates our action. It says that wherever this action is displayed, it will use '&New' as the text, the standard icon, and the standard shortcut. It further says that whenever this action is invoked, it will use the fileNew() slot to execute it.
.PP
.PP
.nf
 QPopupMenu *file = new QPopupMenu;
 newAct->plug(file);
.fi
.PP
 That just inserted the action into the File menu. The point is, it's not important in which menu it is: all manipulation of the item is done through the newAct object.
.PP
.PP
.nf
 newAct->plug(toolBar());
.fi
.PP
 And this inserted the Action into the main toolbar as a button.
.PP
That's it!
.PP
If you want to disable that action sometime later, you can do so with 
.PP
.nf
 newAct->setEnabled(false)

.fi
.PP
 and both the menuitem in File and the toolbar button will instantly be disabled.
.PP
Do not delete a KAction object without unplugging it from all its containers. The simplest way to do that is to use the unplugAll() as in the following example: 
.PP
.nf
 newAct->unplugAll();
 delete newAct;

.fi
.PP
 Normally you will not need to do this as \fBKActionCollection\fP manages everything for you.
.PP
Note: if you are using a 'standard' action like 'new', 'paste', 'quit', or any other action described in the \fBKDE\fP UI Standards, please use the methods in the \fBKStdAction\fP class rather than defining your own.
.PP
\fBUsage Within the XML Framework:\fP
.br
.PP
If you are using KAction within the context of the XML menu and toolbar building framework, then there are a few tiny changes. The first is that you must insert your new action into an action collection. The action collection (a \fBKActionCollection\fP) is, logically enough, a central collection of all of the actions defined in your application. The XML UI framework code in KXMLGUI classes needs access to this collection in order to build up the GUI (it's how the builder code knows which actions are valid and which aren't).
.PP
Also, if you use the XML builder framework, then you do not ever have to plug your actions into containers manually. The framework does that for you.
.PP
\fBSee also:\fP
.RS 4
\fBKStdAction\fP 
.RE
.PP

.PP
Definition at line 202 of file kaction.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBKAction::ActivationReason\fP"
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 490 of file kaction.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KAction::KAction (const \fBQString\fP & text, const \fBKShortcut\fP & cut, const \fBQObject\fP * receiver, const char * slot, \fBKActionCollection\fP * parent, const char * name)"
.PP
Constructs an action with text, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. 
.PP
If you do not want or have a keyboard shortcut, set the \fCcut\fP param to 0.
.PP
This is the most common KAction used when you do not have a corresponding icon (note that it won't appear in the current version of the 'Edit ToolBar' dialog, because an action needs an icon to be plugged in a toolbar...).
.PP
\fBParameters:\fP
.RS 4
\fItext\fP The text that will be displayed. 
.br
\fIcut\fP The corresponding keyboard shortcut. 
.br
\fIreceiver\fP The SLOT's parent. 
.br
\fIslot\fP The SLOT to invoke to execute this action. 
.br
\fIparent\fP This action's parent. 
.br
\fIname\fP An internal name for this action. 
.RE
.PP

.PP
Definition at line 113 of file kaction.cpp.
.SS "KAction::KAction (const \fBQString\fP & text, const \fBQIconSet\fP & pix, const \fBKShortcut\fP & cut, const \fBQObject\fP * receiver, const char * slot, \fBKActionCollection\fP * parent, const char * name)"
.PP
Constructs an action with text, icon, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. 
.PP
If you do not want or have a keyboard shortcut, set the \fCcut\fP param to 0.
.PP
This is the other common KAction used. Use it when you \fCdo\fP have a corresponding icon.
.PP
\fBParameters:\fP
.RS 4
\fItext\fP The text that will be displayed. 
.br
\fIpix\fP The icon to display. 
.br
\fIcut\fP The corresponding keyboard shortcut. 
.br
\fIreceiver\fP The SLOT's parent. 
.br
\fIslot\fP The SLOT to invoke to execute this action. 
.br
\fIparent\fP This action's parent. 
.br
\fIname\fP An internal name for this action. 
.RE
.PP

.PP
Definition at line 130 of file kaction.cpp.
.SS "KAction::KAction (const \fBQString\fP & text, const \fBQString\fP & pix, const \fBKShortcut\fP & cut, const \fBQObject\fP * receiver, const char * slot, \fBKActionCollection\fP * parent, const char * name)"
.PP
Constructs an action with text, icon, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. 
.PP
The icon is loaded on demand later based on where it is plugged in.
.PP
If you do not want or have a keyboard shortcut, set the \fCcut\fP param to 0.
.PP
This is the other common KAction used. Use it when you \fCdo\fP have a corresponding icon.
.PP
\fBParameters:\fP
.RS 4
\fItext\fP The text that will be displayed. 
.br
\fIpix\fP The icon to display. 
.br
\fIcut\fP The corresponding keyboard shortcut (shortcut). 
.br
\fIreceiver\fP The SLOT's parent. 
.br
\fIslot\fP The SLOT to invoke to execute this action. 
.br
\fIparent\fP This action's parent. 
.br
\fIname\fP An internal name for this action. 
.RE
.PP

.PP
Definition at line 121 of file kaction.cpp.
.SS "KAction::KAction (const \fBKGuiItem\fP & item, const \fBKShortcut\fP & cut, const \fBQObject\fP * receiver, const char * slot, \fBKActionCollection\fP * parent, const char * name)"
.PP
The same as the above constructor, but with a \fBKGuiItem\fP providing the text and icon. 
.PP
\fBParameters:\fP
.RS 4
\fIitem\fP The \fBKGuiItem\fP with the label and (optional) icon. 
.br
\fIcut\fP The corresponding keyboard shortcut (shortcut). 
.br
\fIreceiver\fP The SLOT's parent. 
.br
\fIslot\fP The SLOT to invoke to execute this action. 
.br
\fIparent\fP This action's parent. 
.br
\fIname\fP An internal name for this action. 
.RE
.PP

.PP
Definition at line 139 of file kaction.cpp.
.PP
References setToolTip(), and setWhatsThis().
.SS "KAction::KAction (const \fBQString\fP & text, const \fBKShortcut\fP & cut = \fC\fBKShortcut\fP()\fP, \fBQObject\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 152 of file kaction.cpp.
.SS "KAction::KAction (const \fBQString\fP & text, const \fBKShortcut\fP & cut, const \fBQObject\fP * receiver, const char * slot, \fBQObject\fP * parent, const char * name = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 159 of file kaction.cpp.
.SS "KAction::KAction (const \fBQString\fP & text, const \fBQIconSet\fP & pix, const \fBKShortcut\fP & cut = \fC\fBKShortcut\fP()\fP, \fBQObject\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 167 of file kaction.cpp.
.PP
References setIconSet().
.SS "KAction::KAction (const \fBQString\fP & text, const \fBQString\fP & pix, const \fBKShortcut\fP & cut = \fC\fBKShortcut\fP()\fP, \fBQObject\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 176 of file kaction.cpp.
.SS "KAction::KAction (const \fBQString\fP & text, const \fBQIconSet\fP & pix, const \fBKShortcut\fP & cut, const \fBQObject\fP * receiver, const char * slot, \fBQObject\fP * parent, const char * name = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 185 of file kaction.cpp.
.PP
References setIconSet().
.SS "KAction::KAction (const \fBQString\fP & text, const \fBQString\fP & pix, const \fBKShortcut\fP & cut, const \fBQObject\fP * receiver, const char * slot, \fBQObject\fP * parent, const char * name = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 195 of file kaction.cpp.
.SS "KAction::KAction (\fBQObject\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Definition at line 205 of file kaction.cpp.
.SS "KAction::~\fBKAction\fP ()\fC [virtual]\fP"
.PP
Standard destructor. 
.PP
Definition at line 212 of file kaction.cpp.
.PP
References QValueList::constBegin(), QValueList::constEnd(), endl(), kdDebug(), QObject::name(), QValueList::remove(), KActionCollection::take(), and unplugAccel().
.SH "Member Function Documentation"
.PP 
.SS "int KAction::plug (\fBQWidget\fP * widget, int index = \fC-1\fP)\fC [virtual]\fP"
.PP
'Plug' or insert this action into a given widget. 
.PP
This will typically be a menu or a toolbar. From this point on, you will never need to directly manipulate the item in the menu or toolbar. You do all enabling/disabling/manipulation directly with your KAction object.
.PP
\fBParameters:\fP
.RS 4
\fIwidget\fP The GUI element to display this action 
.br
\fIindex\fP The position into which the action is plugged. If this is negative, the action is inserted at the end. 
.RE
.PP

.PP
Reimplemented in \fBKToggleAction\fP, \fBKSelectAction\fP, \fBKRecentFilesAction\fP, \fBKActionMenu\fP, \fBKToolBarPopupAction\fP, \fBKToggleToolBarAction\fP, \fBKWidgetAction\fP, and \fBKPasteTextAction\fP.
.PP
Definition at line 618 of file kaction.cpp.
.PP
References QToolTip::add(), QWhatsThis::add(), QObject::connect(), KActionCollection::connectHighlight(), KActionCollection::count(), QObject::destroyed(), endl(), KToolBar::getButton(), getToolButtonID(), iconSet(), KToolBar::insertButton(), QPopupMenu::insertItem(), KGlobal::instance(), KActionCollection::instance(), QString::isEmpty(), kdDebug(), kdWarning(), QObject::name(), QPopupMenu::setItemEnabled(), QPopupMenu::setWhatsThis(), slotButtonClicked(), and slotPopupActivated().
.PP
Referenced by KPasteTextAction::plug(), KToolBarPopupAction::plug(), and KToggleAction::plug().
.SS "void KAction::plugAccel (\fBKAccel\fP * accel, bool configurable = \fCtrue\fP)\fC [virtual]\fP"
.PP
\fBDeprecated\fP
.RS 4
. Shouldn't be used. No substitute available. 
.RE
.PP
'Plug' or insert this action into a given \fBKAccel\fP.
.PP
\fBParameters:\fP
.RS 4
\fIaccel\fP The \fBKAccel\fP collection which holds this accel 
.br
\fIconfigurable\fP If the shortcut is configurable via the \fBKAccel\fP configuration dialog (this is somehow deprecated since there is now a KAction key configuration dialog). 
.RE
.PP

.PP
Definition at line 763 of file kaction.cpp.
.PP
References QObject::connect(), QObject::destroyed(), endl(), isEnabled(), kdBacktrace(), kdDebug(), kdWarning(), QObject::name(), and unplugAccel().
.SS "void KAction::unplug (\fBQWidget\fP * w)\fC [virtual]\fP"
.PP
'Unplug' or remove this action from a given widget. 
.PP
This will typically be a menu or a toolbar. This is rarely used in 'normal' application. Typically, it would be used if your application has several views or modes, each with a completely different menu structure. If you simply want to disable an action for a given period, use \fBsetEnabled()\fP instead.
.PP
\fBParameters:\fP
.RS 4
\fIw\fP Remove the action from this GUI element. 
.RE
.PP

.PP
Reimplemented in \fBKWidgetAction\fP.
.PP
Definition at line 735 of file kaction.cpp.
.PP
References KActionCollection::disconnectHighlight(), QMenuBar::removeItem(), QPopupMenu::removeItem(), and KToolBar::removeItemDelayed().
.PP
Referenced by KWidgetAction::unplug().
.SS "void KAction::unplugAccel ()\fC [virtual]\fP"
.PP
\fBDeprecated\fP
.RS 4
. Complement method to \fBplugAccel()\fP. Disconnect this action from the \fBKAccel\fP. 
.RE
.PP

.PP
Definition at line 791 of file kaction.cpp.
.PP
References QObject::name().
.PP
Referenced by plugAccel(), and ~KAction().
.SS "bool KAction::isPlugged () const\fC [virtual]\fP"
.PP
returns whether the action is plugged into any container widget or not. 
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 263 of file kaction.cpp.
.PP
Referenced by KDCOPActionProxy::processAction(), and KWidgetAction::unplug().
.SS "bool KAction::isPlugged (const \fBQWidget\fP * container) const"
.PP
returns whether the action is plugged into the given container 
.PP
Definition at line 268 of file kaction.cpp.
.SS "bool KAction::isPlugged (const \fBQWidget\fP * container, int id) const\fC [virtual]\fP"
.PP
returns whether the action is plugged into the given container with the given, container specific, id (often menu or toolbar id ) . 
.PP
Definition at line 273 of file kaction.cpp.
.SS "bool KAction::isPlugged (const \fBQWidget\fP * container, const \fBQWidget\fP * _representative) const\fC [virtual]\fP"
.PP
returns whether the action is plugged into the given container with the given, container specific, representative container widget item. 
.PP
Definition at line 279 of file kaction.cpp.
.SS "uint KAction::kaccelCount () const"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 1067 of file kaction.cpp.
.SS "virtual \fBQString\fP KAction::text () const\fC [virtual]\fP"
.PP
Get the text associated with this action. 
.PP
Referenced by KActionMenu::plug(), and KSelectAction::plug().
.SS "virtual const \fBKShortcut\fP& KAction::shortcut () const\fC [virtual]\fP"
.PP
Get the keyboard shortcut associated with this action. 
.PP
.SS "const \fBKShortcut\fP & KAction::shortcutDefault () const\fC [virtual]\fP"
.PP
Get the default shortcut for this action. 
.PP
Definition at line 545 of file kaction.cpp.
.SS "bool KAction::isEnabled () const\fC [virtual]\fP"
.PP
Returns true if this action is enabled. 
.PP
Definition at line 586 of file kaction.cpp.
.PP
Referenced by KCommandHistory::addCommand(), KPasteTextAction::plug(), KToolBarPopupAction::plug(), KActionMenu::plug(), KRecentFilesAction::plug(), KSelectAction::plug(), plugAccel(), and KCommandHistory::redo().
.SS "bool KAction::isShortcutConfigurable () const\fC [virtual]\fP"
.PP
Returns true if this action's shortcut is configurable. 
.PP
Definition at line 591 of file kaction.cpp.
.SS "virtual \fBQString\fP KAction::whatsThis () const\fC [virtual]\fP"
.PP
Get the What's this text for the action. 
.PP
Referenced by KPasteTextAction::plug(), KWidgetAction::plug(), KToolBarPopupAction::plug(), KActionMenu::plug(), KRecentFilesAction::plug(), and KSelectAction::plug().
.SS "virtual \fBQString\fP KAction::toolTip () const\fC [virtual]\fP"
.PP
Get the tooltip text for the action. 
.PP
Reimplemented in \fBKToggleAction\fP.
.PP
Referenced by KSelectAction::plug(), and KToggleAction::toolTip().
.SS "\fBQIconSet\fP KAction::iconSet (\fBKIcon::Group\fP group, int size = \fC0\fP) const\fC [virtual]\fP"
.PP
Get the \fBQIconSet\fP from which the icons used to display this action will be chosen. 
.PP
Definition at line 985 of file kaction.cpp.
.PP
Referenced by KToolBarPopupAction::plug(), KActionMenu::plug(), KSelectAction::plug(), and plug().
.SS "int KAction::getToolButtonID ()\fC [static]\fP"
.PP
How it works. 
.PP
\fBKActionCollection\fP is an organizing container for KActions. \fBKActionCollection\fP keeps track of the information necessary to handle configuration and shortcuts.
.PP
Focus Widget pointer: This is the widget which is the focus for action shortcuts. It is set either by passing a QWidget* to the \fBKActionCollection\fP constructor or by calling setWidget() if the widget wasn't known when the object was initially constructed (as in \fBKXMLGUIClient\fP and KParts::PartBase)
.PP
Shortcuts: An action's shortcut will not not be connected unless a focus widget has been specified in \fBKActionCollection\fP.
.PP
XML Filename: This is used to save user-modified settings back to the *ui.rc file. It is set by \fBKXMLGUIFactory\fP. 
.PP
Definition at line 66 of file kaction.cpp.
.PP
Referenced by KPasteTextAction::plug(), KWidgetAction::plug(), KToolBarPopupAction::plug(), KActionMenu::plug(), KRecentFilesAction::plug(), KSelectAction::plug(), and plug().
.SS "void KAction::setText (const \fBQString\fP & text)\fC [virtual, slot]\fP"
.PP
Sets the text associated with this action. 
.PP
The text is used for menu and toolbar labels etc. 
.PP
Reimplemented in \fBKToolBarLabelAction\fP.
.PP
Definition at line 863 of file kaction.cpp.
.PP
References QValueList::constBegin(), QValueList::constEnd(), and QObject::name().
.PP
Referenced by KCommandHistory::addCommand(), KCommandHistory::clear(), KCommandHistory::redo(), KToggleFullScreenAction::setChecked(), KToolBarLabelAction::setText(), and KCommandHistory::undo().
.SS "bool KAction::setShortcut (const \fBKShortcut\fP &)\fC [virtual, slot]\fP"
.PP
Sets the keyboard shortcut associated with this action. 
.PP
Definition at line 404 of file kaction.cpp.
.PP
References QValueList::constBegin(), QValueList::constEnd(), and QObject::name().
.PP
Referenced by setAccel().
.SS "void KAction::setWhatsThis (const \fBQString\fP & text)\fC [virtual, slot]\fP"
.PP
Sets the What's this text for the action. 
.PP
This text will be displayed when a widget that has been created by plugging this action into a container is clicked on in What's this mode.
.PP
The What's this text can include QML markup as well as raw text. 
.PP
Definition at line 995 of file kaction.cpp.
.PP
Referenced by KAction(), KStdAction::showMenubar(), and KStdAction::showStatusbar().
.SS "void KAction::setToolTip (const \fBQString\fP &)\fC [virtual, slot]\fP"
.PP
Sets the tooltip text for the action. 
.PP
This will be used as a tooltip for a toolbar button, as a statusbar help-text for a menu item, and it also appears in the toolbar editor, to describe the action.
.PP
For the tooltip to show up on the statusbar you will need to connect a couple of the actionclass signals to the toolbar. The easiest way of doing this is in your main window class, when you create a statusbar. See the \fBKActionCollection\fP class for more details.
.PP
\fBSee also:\fP
.RS 4
\fBKActionCollection\fP 
.RE
.PP

.PP
Definition at line 596 of file kaction.cpp.
.PP
Referenced by KAction().
.SS "void KAction::setIconSet (const \fBQIconSet\fP & iconSet)\fC [virtual, slot]\fP"
.PP
Sets the \fBQIconSet\fP from which the icons used to display this action will be chosen. 
.PP
Definition at line 953 of file kaction.cpp.
.PP
Referenced by KAction().
.SS "void KAction::setEnabled (bool enable)\fC [virtual, slot]\fP"
.PP
Enables or disables this action. 
.PP
All uses of this action (eg. in menus or toolbars) will be updated to reflect the state of the action. 
.PP
Definition at line 816 of file kaction.cpp.
.PP
References QValueList::constBegin(), QValueList::constEnd(), QObject::name(), and QWidget::setEnabled().
.PP
Referenced by KCommandHistory::addCommand(), KCommandHistory::clear(), KWidgetAction::KWidgetAction(), KToggleToolBarAction::plug(), KCommandHistory::redo(), KSelectAction::setItems(), KCommandHistory::undo(), and KCommandHistory::updateActions().
.SS "void KAction::setShortcutConfigurable (bool)\fC [virtual, slot]\fP"
.PP
Indicate whether the user may configure the action's shortcut. 
.PP
Definition at line 858 of file kaction.cpp.
.SS "void KAction::activate ()\fC [virtual, slot]\fP"
.PP
Emulate user's interaction programmatically, by activating the action. 
.PP
The implementation simply emits \fBactivated()\fP. 
.PP
Definition at line 1088 of file kaction.cpp.
.PP
References activated().
.PP
Referenced by KDCOPActionProxy::processAction().
.SS "void KAction::slotPopupActivated ()\fC [protected, slot]\fP"
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 1109 of file kaction.cpp.
.PP
References activated(), endl(), kdDebug(), kdWarning(), KApplication::keyboardMouseState(), QObject::sender(), and KPopupMenu::state().
.PP
Referenced by plug().
.SS "void KAction::slotButtonClicked (int, Qt::ButtonState state)\fC [protected, slot]\fP"
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 1140 of file kaction.cpp.
.PP
References activated(), endl(), and kdDebug().
.PP
Referenced by KToolBarPopupAction::plug(), and plug().
.SS "const \fBKGuiItem\fP & KAction::guiItem () const\fC [protected]\fP"
.PP
Return the underlying \fBKGuiItem\fP 
.PP
\fBSince:\fP
.RS 4
3.3. 
.RE
.PP

.PP
Definition at line 1267 of file kaction.cpp.
.SS "void KAction::activated ()\fC [signal]\fP"
.PP
Emitted when this action is activated. 
.PP
Referenced by activate(), KListAction::KListAction(), KPasteTextAction::KPasteTextAction(), KSelectAction::plug(), slotButtonClicked(), and slotPopupActivated().
.SS "void KAction::activated (\fBKAction::ActivationReason\fP reason, Qt::ButtonState state)\fC [signal]\fP"
.PP
This signal allows to know the reason why an action was activated: whether it was due to a toolbar button, popupmenu, keyboard accel, or programmatically. 
.PP
In the first two cases, it also allows to know which mouse button was used (Left or Middle), and whether keyboard modifiers were pressed (e.g. CTRL).
.PP
Note that this signal is emitted before the normal \fBactivated()\fP signal. Yes, BOTH signals are always emitted, so that connecting to \fBactivated()\fP still works. Applications which care about reason and state can either ignore the \fBactivated()\fP signal for a given action and react to this one instead, or store the reason and state until the \fBactivated()\fP signal is emitted.
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.SS "int KAction::accel () const"
.PP
\fBDeprecated\fP
.RS 4
. Use \fBshortcut()\fP. Get the keyboard accelerator associated with this action. 
.RE
.PP

.PP
Definition at line 561 of file kaction.cpp.
.SS "void KAction::setAccel (int key)"
.PP
\fBDeprecated\fP
.RS 4
. Use \fBsetShortcut()\fP. Sets the keyboard accelerator associated with this action. 
.RE
.PP

.PP
Definition at line 497 of file kaction.cpp.
.PP
References setShortcut().
.SS "void KAction::setStatusText (const \fBQString\fP & text)\fC [inline]\fP"
.PP
\fBDeprecated\fP
.RS 4
. Use setToolTip instead (they do the same thing now). 
.RE
.PP

.PP
Definition at line 647 of file kaction.h.
.SS "int KAction::menuId (int i)\fC [inline]\fP"
.PP
\fBDeprecated\fP
.RS 4
. for backwards compatibility. Use itemId() 
.RE
.PP

.PP
Definition at line 653 of file kaction.h.

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
