\section{KAction Class Reference}
\label{classKAction}\index{KAction@{KAction}}
The KAction class (and derived and super classes) provides a way to easily encapsulate a \char`\"{}real\char`\"{} user-selected action or event in your program. Class to encapsulate user-driven action or event.  


{\tt \#include $<$kaction.h$>$}

Inheritance diagram for KAction:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=177pt]{classKAction__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KAction:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=108pt]{classKAction__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
virtual void {\bf set\-Text} (const  {\bf QString} \&text)
\begin{CompactList}\small\item\em Sets the text associated with this action. \item\end{CompactList}\item 
virtual bool {\bf set\-Shortcut} (const  KShortcut \&)
\begin{CompactList}\small\item\em Sets the keyboard shortcut associated with this action. \item\end{CompactList}\item 
virtual void {\bf set\-Group} (const  {\bf QString} \&)\label{classKAction_i2}

\item 
virtual void {\bf set\-Whats\-This} (const  {\bf QString} \&text)
\begin{CompactList}\small\item\em Sets the What's this text for the action. \item\end{CompactList}\item 
virtual void {\bf set\-Tool\-Tip} (const  {\bf QString} \&)
\begin{CompactList}\small\item\em Sets the tooltip text for the action. \item\end{CompactList}\item 
virtual void {\bf set\-Icon\-Set} (const  {\bf QIcon\-Set} \&icon\-Set)
\begin{CompactList}\small\item\em Sets the {\bf QIcon\-Set} from which the icons used to display this action will be chosen. \item\end{CompactList}\item 
virtual void {\bf set\-Icon} (const  {\bf QString} \&icon)\label{classKAction_i6}

\item 
virtual void {\bf set\-Enabled} (bool enable)
\begin{CompactList}\small\item\em Enables or disables this action. \item\end{CompactList}\item 
virtual void {\bf set\-Shortcut\-Configurable} (bool)
\begin{CompactList}\small\item\em Indicate whether the user may configure the action's shortcut. \item\end{CompactList}\item 
virtual void {\bf activate} ()
\begin{CompactList}\small\item\em Emulate user's interaction programmatically, by activating the action. \item\end{CompactList}\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf activated} ()\label{classKAction_l0}

\item 
void {\bf enabled} (bool)\label{classKAction_l1}

\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KAction} (const  {\bf QString} \&text, const  KShortcut \&cut, const  {\bf QObject} $\ast$receiver, const  char $\ast$slot, {\bf KAction\-Collection} $\ast${\bf parent}, const  char $\ast${\bf name})
\begin{CompactList}\small\item\em Constructs an action with text, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. \item\end{CompactList}\item 
{\bf KAction} (const  {\bf QString} \&text, const  {\bf QIcon\-Set} \&pix, const  KShortcut \&cut, const  {\bf QObject} $\ast$receiver, const  char $\ast$slot, {\bf KAction\-Collection} $\ast${\bf parent}, const  char $\ast${\bf name})
\begin{CompactList}\small\item\em Constructs an action with text, icon, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. \item\end{CompactList}\item 
{\bf KAction} (const  {\bf QString} \&text, const  {\bf QString} \&pix, const  KShortcut \&cut, const  {\bf QObject} $\ast$receiver, const  char $\ast$slot, {\bf KAction\-Collection} $\ast${\bf parent}, const  char $\ast${\bf name})
\begin{CompactList}\small\item\em Constructs an action with text, icon, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. \item\end{CompactList}\item 
{\bf KAction} (const  KGui\-Item \&item, const  KShortcut \&cut, const  {\bf QObject} $\ast$receiver, const  char $\ast$slot, {\bf KAction\-Collection} $\ast${\bf parent}, const  char $\ast${\bf name})
\begin{CompactList}\small\item\em The same as the above constructor, but with a KGui\-Item providing the text and icon. \item\end{CompactList}\item 
{\bf KAction} (const  {\bf QString} \&text, const  KShortcut \&cut=KShortcut(), {\bf QObject} $\ast${\bf parent}=0, const  char $\ast${\bf name}=0)
\item 
{\bf KAction} (const  {\bf QString} \&text, const  KShortcut \&cut, const  {\bf QObject} $\ast$receiver, const  char $\ast$slot, {\bf QObject} $\ast${\bf parent}, const  char $\ast${\bf name}=0)
\item 
{\bf KAction} (const  {\bf QString} \&text, const  {\bf QIcon\-Set} \&pix, const  KShortcut \&cut=KShortcut(), {\bf QObject} $\ast${\bf parent}=0, const  char $\ast${\bf name}=0)
\item 
{\bf KAction} (const  {\bf QString} \&text, const  {\bf QString} \&pix, const  KShortcut \&cut=KShortcut(), {\bf QObject} $\ast${\bf parent}=0, const  char $\ast${\bf name}=0)
\item 
{\bf KAction} (const  {\bf QString} \&text, const  {\bf QIcon\-Set} \&pix, const  KShortcut \&cut, const  {\bf QObject} $\ast$receiver, const  char $\ast$slot, {\bf QObject} $\ast${\bf parent}, const  char $\ast${\bf name}=0)
\item 
{\bf KAction} (const  {\bf QString} \&text, const  {\bf QString} \&pix, const  KShortcut \&cut, const  {\bf QObject} $\ast$receiver, const  char $\ast$slot, {\bf QObject} $\ast${\bf parent}, const  char $\ast${\bf name}=0)
\item 
{\bf KAction} ({\bf QObject} $\ast${\bf parent}=0, const  char $\ast${\bf name}=0)
\item 
virtual {\bf $\sim$KAction} ()
\begin{CompactList}\small\item\em Standard destructor. \item\end{CompactList}\item 
virtual int {\bf plug} ({\bf QWidget} $\ast$w, int index=-1)
\begin{CompactList}\small\item\em \char`\"{}Plug\char`\"{} or insert this action into a given widget. \item\end{CompactList}\item 
virtual void {\bf plug\-Accel} ({\bf KAccel} $\ast$accel, bool configurable=true)
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.}. \item\end{CompactList}\item 
virtual void {\bf unplug} ({\bf QWidget} $\ast$w)
\begin{CompactList}\small\item\em \char`\"{}Unplug\char`\"{} or remove this action from a given widget. \item\end{CompactList}\item 
virtual void {\bf unplug\-Accel} ()
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.}. \item\end{CompactList}\item 
virtual bool {\bf is\-Plugged} () const 
\begin{CompactList}\small\item\em returns whether the action is plugged into any container widget or not. \item\end{CompactList}\item 
bool {\bf is\-Plugged} (const  {\bf QWidget} $\ast$container) const 
\begin{CompactList}\small\item\em returns whether the action is plugged into the given container \item\end{CompactList}\item 
virtual bool {\bf is\-Plugged} (const  {\bf QWidget} $\ast$container, int id) const 
\begin{CompactList}\small\item\em returns whether the action is plugged into the given container with the given, container specific, id (often menu or toolbar id ) . \item\end{CompactList}\item 
virtual bool {\bf is\-Plugged} (const  {\bf QWidget} $\ast$container, const  {\bf QWidget} $\ast$\_\-representative) const 
\begin{CompactList}\small\item\em returns whether the action is plugged into the given container with the given, container specific, representative container widget item. \item\end{CompactList}\item 
{\bf QWidget} $\ast$ {\bf container} (int index) const \label{classKAction_a20}

\item 
int {\bf item\-Id} (int index) const \label{classKAction_a21}

\item 
{\bf QWidget} $\ast$ {\bf representative} (int index) const \label{classKAction_a22}

\item 
int {\bf container\-Count} () const \label{classKAction_a23}

\item 
uint {\bf kaccel\-Count} () const 
\begin{CompactList}\small\item\em \begin{Desc}
\item[Since:]3.1 \end{Desc}
\item\end{CompactList}\item 
virtual bool {\bf has\-Icon} () const \label{classKAction_a25}

\item 
bool {\bf has\-Icon\-Set} () const \label{classKAction_a26}

\item 
virtual {\bf QString} {\bf plain\-Text} () const \label{classKAction_a27}

\item 
virtual {\bf QString} {\bf text} () const 
\begin{CompactList}\small\item\em Get the text associated with this action. \item\end{CompactList}\item 
virtual const  KShortcut \& {\bf shortcut} () const 
\begin{CompactList}\small\item\em Get the keyboard shortcut associated with this action. \item\end{CompactList}\item 
virtual const  KShortcut \& {\bf shortcut\-Default} () const 
\begin{CompactList}\small\item\em Get the default shortcut for this action. \item\end{CompactList}\item 
{\bf QString} {\bf shortcut\-Text} () const \label{classKAction_a31}

\item 
void {\bf set\-Shortcut\-Text} (const  {\bf QString} \&)\label{classKAction_a32}

\item 
virtual bool {\bf is\-Enabled} () const 
\begin{CompactList}\small\item\em Returns true if this action is enabled. \item\end{CompactList}\item 
virtual bool {\bf is\-Shortcut\-Configurable} () const 
\begin{CompactList}\small\item\em Returns true if this action's shortcut is configurable. \item\end{CompactList}\item 
virtual {\bf QString} {\bf group} () const \label{classKAction_a35}

\item 
virtual {\bf QString} {\bf whats\-This} () const 
\begin{CompactList}\small\item\em Get the What's this text for the action. \item\end{CompactList}\item 
virtual {\bf QString} {\bf tool\-Tip} () const 
\begin{CompactList}\small\item\em Get the tooltip text for the action. \item\end{CompactList}\item 
virtual {\bf QIcon\-Set} {\bf icon\-Set} ({\bf KIcon::Group} group, int size=0) const 
\begin{CompactList}\small\item\em Get the {\bf QIcon\-Set} from which the icons used to display this action will be chosen. \item\end{CompactList}\item 
{\bf QIcon\-Set} {\bf icon\-Set} () const \label{classKAction_a39}

\item 
virtual {\bf QString} {\bf icon} () const \label{classKAction_a40}

\item 
{\bf KAction\-Collection} $\ast$ {\bf parent\-Collection} () const \label{classKAction_a41}

\item 
void {\bf unplug\-All} ()\label{classKAction_a42}

\item 
int {\bf accel} () const 
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.}. \item\end{CompactList}\item 
{\bf QString} {\bf status\-Text} () const \label{classKAction_a44}

\item 
void {\bf set\-Accel} (int key)
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.}. \item\end{CompactList}\item 
void {\bf set\-Status\-Text} (const  {\bf QString} \&text)
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.}. \item\end{CompactList}\item 
int {\bf menu\-Id} (int i)
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
int {\bf get\-Tool\-Button\-ID} ()\label{classKAction_e0}

\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
virtual void {\bf slot\-Destroyed} ()\label{classKAction_j0}

\item 
virtual void {\bf slot\-Keycode\-Changed} ()\label{classKAction_j1}

\item 
virtual void {\bf slot\-Activated} ()\label{classKAction_j2}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KTool\-Bar} $\ast$ {\bf tool\-Bar} (int index) const \label{classKAction_b0}

\item 
{\bf QPopup\-Menu} $\ast$ {\bf popup\-Menu} (int index) const \label{classKAction_b1}

\item 
void {\bf remove\-Container} (int index)\label{classKAction_b2}

\item 
int {\bf find\-Container} (const  {\bf QWidget} $\ast$widget) const \label{classKAction_b3}

\item 
void {\bf plug\-Main\-Window\-Accel} ({\bf QWidget} $\ast$w)\label{classKAction_b4}

\item 
void {\bf add\-Container} ({\bf QWidget} $\ast${\bf parent}, int id)\label{classKAction_b5}

\item 
void {\bf add\-Container} ({\bf QWidget} $\ast${\bf parent}, {\bf QWidget} $\ast$representative)\label{classKAction_b6}

\item 
virtual void {\bf update\-Shortcut} (int i)\label{classKAction_b7}

\item 
virtual void {\bf update\-Shortcut} ({\bf QPopup\-Menu} $\ast$menu, int id)\label{classKAction_b8}

\item 
virtual void {\bf update\-Group} (int id)\label{classKAction_b9}

\item 
virtual void {\bf update\-Text} (int i)\label{classKAction_b10}

\item 
virtual void {\bf update\-Enabled} (int i)\label{classKAction_b11}

\item 
virtual void {\bf update\-Icon\-Set} (int i)\label{classKAction_b12}

\item 
virtual void {\bf update\-Icon} (int i)\label{classKAction_b13}

\item 
virtual void {\bf update\-Tool\-Tip} (int id)\label{classKAction_b14}

\item 
virtual void {\bf update\-Whats\-This} (int i)\label{classKAction_b15}

\item 
{\bf QString} {\bf whats\-This\-With\-Icon} () const \label{classKAction_b16}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKAction_b17}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf KAction\-Collection} $\ast$ {\bf m\_\-parent\-Collection}\label{classKAction_p0}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KAction\-Collection}\label{classKAction_n0}

\end{CompactItemize}


\subsection{Detailed Description}
The KAction class (and derived and super classes) provides a way to easily encapsulate a \char`\"{}real\char`\"{} user-selected action or event in your program. Class to encapsulate user-driven action or event. 

For instance, a user may want to {\tt paste} the contents of the clipboard or {\tt scroll} {\tt down} a document or {\tt quit} the application. These are all {\tt actions} -- events that the user causes to happen. The KAction class allows the developer to deal with these actions in an easy and intuitive manner.

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 \char`\"{}paste\char`\"{} action or scissors for a \char`\"{}cut\char`\"{} action). The action might have some text to describe the action. It will certainly have a method or function that actually {\tt executes} the action! All these attributes are contained within the KAction object.

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 \char`\"{}normal\char`\"{} way of dealing with actions like \char`\"{}cut\char`\"{}, 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 woud 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!

With the Action concept, you simply \char`\"{}plug\char`\"{} 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 \char`\"{}cut\char`\"{} example: if you want to disable the Cut Action, you would simply do 'cut\-Action-$>$set\-Enabled(false)' and the menuitem and button would instantly be disabled!

This is the biggest advantage to the Action concept -- there is a one-to-one relationship between the \char`\"{}real\char`\"{} action and {\tt all} GUI representations of it.

KAction emits the activated() signal if the user activated the corresponding GUI element ( menu item, toolbar button, etc. )

If you are in the situation of wanting to map the activated() signal of multiple action objects to one slot, with a special argument bound to each action, then you might consider using {\bf QSignal\-Mapper} . A tiny example:

\small\begin{alltt}
 {\bf QSignalMapper} *desktopNumberMapper = new QSignalMapper( this );
 connect( desktopNumberMapper, SIGNAL( mapped( int ) ),
          this, SLOT( moveWindowToDesktop( int ) ) );\end{alltt}\normalsize 


\small\begin{alltt} 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 );
 \}
 \end{alltt}\normalsize 


{\bf  General Usage:}

{\bf  The steps to using actions are roughly as follows}

{\bf  \begin{itemize}
\item Decide which attributes you want to associate with a given action (icons, text, keyboard shortcut, etc) \item Create the action using KAction (or derived or super class). \item \char`\"{}Plug\char`\"{} the Action into whatever GUI element you want. Typically, this will be a menu or toolbar.\end{itemize}
}

{\bf {\bf  Detailed Example:}}

{\bf {\bf  Here is an example of enabling a \char`\"{}New [document]\char`\"{} action \small\begin{alltt}
 KAction *newAct = new KAction(i18n("&New"), "filenew",
                               KStdAccel::shortcut(KStdAccel::New),
                               this, SLOT(fileNew()),
                               actionCollection(), "new");
 \end{alltt}\normalsize 
 This line creates our action. It says that wherever this action is displayed, it will use \char`\"{}\&New\char`\"{} as the text, the standard icon, and the standard shortcut. It further says that whenever this action is invoked, it will use the file\-New() slot to execute it.}}

{\bf {\bf  \small\begin{alltt}
 {\bf QPopupMenu} *file = new {\bf QPopupMenu};
 newAct-$>$plug(file);
 \end{alltt}\normalsize 
 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 new\-Act object.}}

{\bf {\bf  \small\begin{alltt}
 newAct-$>$plug(toolBar());
 \end{alltt}\normalsize 
 And this inserted the Action into the main toolbar as a button.}}

{\bf {\bf  That's it!}}

{\bf {\bf  If you want to disable that action sometime later, you can do so with \small\begin{alltt}
 newAct-$>$setEnabled(false)
 \end{alltt}\normalsize 
 and both the menuitem in File and the toolbar button will instantly be disabled.}}

{\bf {\bf  Note: if you are using a \char`\"{}standard\char`\"{} action like \char`\"{}new\char`\"{}, \char`\"{}paste\char`\"{}, \char`\"{}quit\char`\"{}, or any other action described in the {\bf KDE} UI Standards, please use the methods in the {\bf KStd\-Action}{\rm (p.\,\pageref{namespaceKStdAction})} class rather than defining your own.}}

{\bf {\bf  }}

{\bf {\bf {\bf  Usage Within the XML Framework:}}}

{\bf {\bf {\bf  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 {\bf KAction\-Collection}{\rm (p.\,\pageref{classKActionCollection})}) 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).}}}

{\bf {\bf {\bf  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.}}}

{\bf {\bf {\bf  \begin{Desc}
\item[See also:]{\bf KStd\-Action}{\rm (p.\,\pageref{namespaceKStdAction})} \end{Desc}
}}}



Definition at line 191 of file kaction.h.

\subsection{Constructor \& Destructor Documentation}
\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const KShortcut \& {\em cut}, const {\bf QObject} $\ast$ {\em receiver}, const char $\ast$ {\em slot}, {\bf KAction\-Collection} $\ast$ {\em parent}, const char $\ast$ {\em name})}\label{classKAction_a0}


Constructs an action with text, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. 

If you do not want or have a keyboard shortcut, set the {\tt cut} param to 0.

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 \char`\"{}Edit Tool\-Bar\char`\"{} dialog, because an action needs an icon to be plugged in a toolbar...).

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]The text that will be displayed. \item[{\em cut}]The corresponding keyboard shortcut. \item[{\em receiver}]The SLOT's parent. \item[{\em slot}]The SLOT to invoke to execute this action. \item[{\em parent}]This action's parent. \item[{\em name}]An internal name for this action. \end{description}
\end{Desc}


Definition at line 169 of file kaction.cpp.

References KStd\-Accel::cut(), and QObject::name().\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const {\bf QIcon\-Set} \& {\em pix}, const KShortcut \& {\em cut}, const {\bf QObject} $\ast$ {\em receiver}, const char $\ast$ {\em slot}, {\bf KAction\-Collection} $\ast$ {\em parent}, const char $\ast$ {\em name})}\label{classKAction_a1}


Constructs an action with text, icon, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. 

If you do not want or have a keyboard shortcut, set the {\tt cut} param to 0.

This is the other common KAction used. Use it when you {\tt do} have a corresponding icon.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]The text that will be displayed. \item[{\em pix}]The icon to display. \item[{\em cut}]The corresponding keyboard shortcut. \item[{\em receiver}]The SLOT's parent. \item[{\em slot}]The SLOT to invoke to execute this action. \item[{\em parent}]This action's parent. \item[{\em name}]An internal name for this action. \end{description}
\end{Desc}


Definition at line 186 of file kaction.cpp.

References KStd\-Accel::cut(), and KStd\-Accel::name().\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const {\bf QString} \& {\em pix}, const KShortcut \& {\em cut}, const {\bf QObject} $\ast$ {\em receiver}, const char $\ast$ {\em slot}, {\bf KAction\-Collection} $\ast$ {\em parent}, const char $\ast$ {\em name})}\label{classKAction_a2}


Constructs an action with text, icon, potential keyboard shortcut, and a SLOT to call when this action is invoked by the user. 

The icon is loaded on demand later based on where it is plugged in.

If you do not want or have a keyboard shortcut, set the {\tt cut} param to 0.

This is the other common KAction used. Use it when you {\tt do} have a corresponding icon.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]The text that will be displayed. \item[{\em pix}]The icon to display. \item[{\em cut}]The corresponding keyboard shortcut (shortcut). \item[{\em receiver}]The SLOT's parent. \item[{\em slot}]The SLOT to invoke to execute this action. \item[{\em parent}]This action's parent. \item[{\em name}]An internal name for this action. \end{description}
\end{Desc}


Definition at line 177 of file kaction.cpp.

References KStd\-Accel::cut(), and KStd\-Accel::name().\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const KGui\-Item \& {\em item}, const KShortcut \& {\em cut}, const {\bf QObject} $\ast$ {\em receiver}, const char $\ast$ {\em slot}, {\bf KAction\-Collection} $\ast$ {\em parent}, const char $\ast$ {\em name})}\label{classKAction_a3}


The same as the above constructor, but with a KGui\-Item providing the text and icon. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em item}]The KGui\-Item with the label and (optional) icon. \end{description}
\end{Desc}


Definition at line 195 of file kaction.cpp.

References KStd\-Accel::cut(), KStd\-Accel::name(), set\-Tool\-Tip(), and set\-Whats\-This().\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const KShortcut \& {\em cut} = KShortcut(), {\bf QObject} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKAction_a4}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const KShortcut \& {\em cut}, const {\bf QObject} $\ast$ {\em receiver}, const char $\ast$ {\em slot}, {\bf QObject} $\ast$ {\em parent}, const char $\ast$ {\em name} = 0)}\label{classKAction_a5}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const {\bf QIcon\-Set} \& {\em pix}, const KShortcut \& {\em cut} = KShortcut(), {\bf QObject} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKAction_a6}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const {\bf QString} \& {\em pix}, const KShortcut \& {\em cut} = KShortcut(), {\bf QObject} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKAction_a7}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const {\bf QIcon\-Set} \& {\em pix}, const KShortcut \& {\em cut}, const {\bf QObject} $\ast$ {\em receiver}, const char $\ast$ {\em slot}, {\bf QObject} $\ast$ {\em parent}, const char $\ast$ {\em name} = 0)}\label{classKAction_a8}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction (const {\bf QString} \& {\em text}, const {\bf QString} \& {\em pix}, const KShortcut \& {\em cut}, const {\bf QObject} $\ast$ {\em receiver}, const char $\ast$ {\em slot}, {\bf QObject} $\ast$ {\em parent}, const char $\ast$ {\em name} = 0)}\label{classKAction_a9}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\index{KAction@{KAction}!KAction@{KAction}}
\index{KAction@{KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::KAction ({\bf QObject} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKAction_a10}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\index{KAction@{KAction}!~KAction@{$\sim$KAction}}
\index{~KAction@{$\sim$KAction}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KAction::$\sim${\bf KAction} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a11}


Standard destructor. 



Definition at line 268 of file kaction.cpp.

References QObject::name(), KAction\-Collection::take(), and unplug\-Accel().

\subsection{Member Function Documentation}
\index{KAction@{KAction}!plug@{plug}}
\index{plug@{plug}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KAction::plug ({\bf QWidget} $\ast$ {\em w}, int {\em index} = -1)\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a12}


\char`\"{}Plug\char`\"{} or insert this action into a given widget. 

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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The GUI element to display this action \end{description}
\end{Desc}


Reimplemented in {\bf KToggle\-Action} {\rm (p.\,\pageref{classKToggleAction_a8})}, {\bf KSelect\-Action} {\rm (p.\,\pageref{classKSelectAction_a8})}, {\bf KAction\-Menu} {\rm (p.\,\pageref{classKActionMenu_a13})}, {\bf KTool\-Bar\-Popup\-Action} {\rm (p.\,\pageref{classKToolBarPopupAction_a4})}, {\bf KToggle\-Tool\-Bar\-Action} {\rm (p.\,\pageref{classKToggleToolBarAction_a3})}, and {\bf KWidget\-Action} {\rm (p.\,\pageref{classKWidgetAction_a4})}.

Definition at line 653 of file kaction.cpp.

References QTool\-Tip::add(), QWhats\-This::add(), QObject::connect(), KAction\-Collection::connect\-Highlight(), QObject::destroyed(), KTool\-Bar::get\-Button(), icon\-Set(), KTool\-Bar::insert\-Button(), QPopup\-Menu::insert\-Item(), KGlobal::instance(), KAction\-Collection::instance(), KNotify\-Client::instance(), QString::is\-Empty(), QObject::name(), QPopup\-Menu::set\-Item\-Enabled(), and QPopup\-Menu::set\-Whats\-This().

Referenced by KTool\-Bar\-Popup\-Action::plug(), and KToggle\-Action::plug().\index{KAction@{KAction}!plugAccel@{plugAccel}}
\index{plugAccel@{plugAccel}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::plug\-Accel ({\bf KAccel} $\ast$ {\em accel}, bool {\em configurable} = true)\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a13}


{\bf This class or method is obsolete, it is provided for compatibility only.}. 

Shouldn't be used. No substitute available.

\char`\"{}Plug\char`\"{} or insert this action into a given {\bf KAccel}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em accel}]The {\bf KAccel} collection which holds this accel \item[{\em configurable}]If the shortcut is configurable via the {\bf KAccel} configuration dialog (this is somehow deprecated since there is now a KAction key configuration dialog). \end{description}
\end{Desc}


Definition at line 791 of file kaction.cpp.

References KAccel::actions(), QObject::connect(), QObject::destroyed(), is\-Enabled(), QObject::name(), and unplug\-Accel().\index{KAction@{KAction}!unplug@{unplug}}
\index{unplug@{unplug}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::unplug ({\bf QWidget} $\ast$ {\em w})\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a14}


\char`\"{}Unplug\char`\"{} or remove this action from a given widget. 

This will typically be a menu or a toolbar. This is rarely used in \char`\"{}normal\char`\"{} 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 {\bf set\-Enabled}{\rm (p.\,\pageref{classKAction_i7})}() instead.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]Remove the action from this GUI element. \end{description}
\end{Desc}


Reimplemented in {\bf KWidget\-Action} {\rm (p.\,\pageref{classKWidgetAction_a5})}.

Definition at line 763 of file kaction.cpp.

References KAction\-Collection::disconnect\-Highlight(), QMenu\-Bar::remove\-Item(), KTool\-Bar::remove\-Item(), and QPopup\-Menu::remove\-Item().

Referenced by KWidget\-Action::unplug().\index{KAction@{KAction}!unplugAccel@{unplugAccel}}
\index{unplugAccel@{unplugAccel}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::unplug\-Accel ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a15}


{\bf This class or method is obsolete, it is provided for compatibility only.}. 

Complement method to {\bf plug\-Accel()}{\rm (p.\,\pageref{classKAction_a13})}. Disconnect this action from the {\bf KAccel}. 

Definition at line 819 of file kaction.cpp.

References QObject::name().

Referenced by plug\-Accel(), and $\sim$KAction().\index{KAction@{KAction}!isPlugged@{isPlugged}}
\index{isPlugged@{isPlugged}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAction::is\-Plugged () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a16}


returns whether the action is plugged into any container widget or not. 

\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 314 of file kaction.cpp.

Referenced by KWidget\-Action::unplug().\index{KAction@{KAction}!isPlugged@{isPlugged}}
\index{isPlugged@{isPlugged}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAction::is\-Plugged (const {\bf QWidget} $\ast$ {\em container}) const}\label{classKAction_a17}


returns whether the action is plugged into the given container 



Definition at line 319 of file kaction.cpp.\index{KAction@{KAction}!isPlugged@{isPlugged}}
\index{isPlugged@{isPlugged}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAction::is\-Plugged (const {\bf QWidget} $\ast$ {\em container}, int {\em id}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a18}


returns whether the action is plugged into the given container with the given, container specific, id (often menu or toolbar id ) . 



Definition at line 324 of file kaction.cpp.\index{KAction@{KAction}!isPlugged@{isPlugged}}
\index{isPlugged@{isPlugged}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAction::is\-Plugged (const {\bf QWidget} $\ast$ {\em container}, const {\bf QWidget} $\ast$ {\em \_\-representative}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a19}


returns whether the action is plugged into the given container with the given, container specific, representative container widget item. 



Definition at line 330 of file kaction.cpp.\index{KAction@{KAction}!kaccelCount@{kaccelCount}}
\index{kaccelCount@{kaccelCount}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint KAction::kaccel\-Count () const}\label{classKAction_a24}


\begin{Desc}
\item[Since:]3.1 \end{Desc}




Definition at line 1079 of file kaction.cpp.\index{KAction@{KAction}!text@{text}}
\index{text@{text}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KAction::text () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a28}


Get the text associated with this action. 



Definition at line 926 of file kaction.cpp.

Referenced by KAction\-Menu::plug(), and KSelect\-Action::plug().\index{KAction@{KAction}!shortcut@{shortcut}}
\index{shortcut@{shortcut}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  KShortcut \& KAction::shortcut () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a29}


Get the keyboard shortcut associated with this action. 



Definition at line 577 of file kaction.cpp.\index{KAction@{KAction}!shortcutDefault@{shortcutDefault}}
\index{shortcutDefault@{shortcutDefault}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  KShortcut \& KAction::shortcut\-Default () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a30}


Get the default shortcut for this action. 



Definition at line 582 of file kaction.cpp.\index{KAction@{KAction}!isEnabled@{isEnabled}}
\index{isEnabled@{isEnabled}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAction::is\-Enabled () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a33}


Returns true if this action is enabled. 



Definition at line 621 of file kaction.cpp.

Referenced by KCommand\-History::add\-Command(), KTool\-Bar\-Popup\-Action::plug(), KAction\-Menu::plug(), KSelect\-Action::plug(), plug\-Accel(), and KCommand\-History::redo().\index{KAction@{KAction}!isShortcutConfigurable@{isShortcutConfigurable}}
\index{isShortcutConfigurable@{isShortcutConfigurable}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAction::is\-Shortcut\-Configurable () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a34}


Returns true if this action's shortcut is configurable. 



Definition at line 626 of file kaction.cpp.\index{KAction@{KAction}!whatsThis@{whatsThis}}
\index{whatsThis@{whatsThis}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KAction::whats\-This () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a36}


Get the What's this text for the action. 



Definition at line 1035 of file kaction.cpp.

Referenced by KTool\-Bar\-Popup\-Action::plug(), KAction\-Menu::plug(), and KSelect\-Action::plug().\index{KAction@{KAction}!toolTip@{toolTip}}
\index{toolTip@{toolTip}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KAction::tool\-Tip () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a37}


Get the tooltip text for the action. 



Definition at line 648 of file kaction.cpp.

Referenced by KSelect\-Action::plug().\index{KAction@{KAction}!iconSet@{iconSet}}
\index{iconSet@{iconSet}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QIcon\-Set} KAction::icon\-Set ({\bf KIcon::Group} {\em group}, int {\em size} = 0) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKAction_a38}


Get the {\bf QIcon\-Set} from which the icons used to display this action will be chosen. 



Definition at line 997 of file kaction.cpp.

Referenced by KAction\-Menu::plug(), KSelect\-Action::plug(), and plug().\index{KAction@{KAction}!setText@{setText}}
\index{setText@{setText}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Text (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i0}


Sets the text associated with this action. 

The text is used for menu and toolbar labels etc. 

Definition at line 884 of file kaction.cpp.

References QObject::name().

Referenced by KCommand\-History::add\-Command(), KCommand\-History::clear(), KCommand\-History::redo(), and KCommand\-History::undo().\index{KAction@{KAction}!setShortcut@{setShortcut}}
\index{setShortcut@{setShortcut}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KAction::set\-Shortcut (const KShortcut \&)\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i1}


Sets the keyboard shortcut associated with this action. 



Definition at line 451 of file kaction.cpp.

References KStd\-Accel::cut(), and QObject::name().\index{KAction@{KAction}!setWhatsThis@{setWhatsThis}}
\index{setWhatsThis@{setWhatsThis}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Whats\-This (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i3}


Sets the What's this text for the action. 

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.

The What's this text can include QML markup as well as raw text. 

Definition at line 1007 of file kaction.cpp.

Referenced by KAction().\index{KAction@{KAction}!setToolTip@{setToolTip}}
\index{setToolTip@{setToolTip}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Tool\-Tip (const {\bf QString} \&)\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i4}


Sets the tooltip text for the action. 

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. 

Definition at line 631 of file kaction.cpp.

Referenced by KAction(), and set\-Status\-Text().\index{KAction@{KAction}!setIconSet@{setIconSet}}
\index{setIconSet@{setIconSet}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Icon\-Set (const {\bf QIcon\-Set} \& {\em icon\-Set})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i5}


Sets the {\bf QIcon\-Set} from which the icons used to display this action will be chosen. 



Definition at line 966 of file kaction.cpp.\index{KAction@{KAction}!setEnabled@{setEnabled}}
\index{setEnabled@{setEnabled}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Enabled (bool {\em enable})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i7}


Enables or disables this action. 

All uses of this action (eg. in menus or toolbars) will be updated to reflect the state of the action. 

Definition at line 844 of file kaction.cpp.

References QObject::name().

Referenced by KCommand\-History::add\-Command(), KCommand\-History::clear(), KToggle\-Tool\-Bar\-Action::plug(), KCommand\-History::redo(), KSelect\-Action::set\-Items(), KCommand\-History::undo(), and KCommand\-History::update\-Actions().\index{KAction@{KAction}!setShortcutConfigurable@{setShortcutConfigurable}}
\index{setShortcutConfigurable@{setShortcutConfigurable}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Shortcut\-Configurable (bool)\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i8}


Indicate whether the user may configure the action's shortcut. 



Definition at line 879 of file kaction.cpp.\index{KAction@{KAction}!activate@{activate}}
\index{activate@{activate}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::activate ()\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKAction_i9}


Emulate user's interaction programmatically, by activating the action. 

The implementation simply emits activated(). 

Definition at line 1100 of file kaction.cpp.\index{KAction@{KAction}!accel@{accel}}
\index{accel@{accel}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KAction::accel () const}\label{classKAction_a43}


{\bf This class or method is obsolete, it is provided for compatibility only.}. 

Use {\bf shortcut()}{\rm (p.\,\pageref{classKAction_a29})}. Get the keyboard accelerator associated with this action. 

Definition at line 597 of file kaction.cpp.\index{KAction@{KAction}!setAccel@{setAccel}}
\index{setAccel@{setAccel}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Accel (int {\em key})}\label{classKAction_a45}


{\bf This class or method is obsolete, it is provided for compatibility only.}. 

Use {\bf set\-Shortcut()}{\rm (p.\,\pageref{classKAction_i1})}. Sets the keyboard accelerator associated with this action. \index{KAction@{KAction}!setStatusText@{setStatusText}}
\index{setStatusText@{setStatusText}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KAction::set\-Status\-Text (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [inline]}}\label{classKAction_a46}


{\bf This class or method is obsolete, it is provided for compatibility only.}. 

Use set\-Tool\-Tip instead (they do the same thing now). 

Definition at line 588 of file kaction.h.

References set\-Tool\-Tip().\index{KAction@{KAction}!menuId@{menuId}}
\index{menuId@{menuId}!KAction@{KAction}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KAction::menu\-Id (int {\em i})\hspace{0.3cm}{\tt  [inline]}}\label{classKAction_a47}


{\bf This class or method is obsolete, it is provided for compatibility only.}. 

for backwards compatibility. 

Definition at line 594 of file kaction.h.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kaction.h\item 
kaction.cpp\end{CompactItemize}
