You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
521 lines
35 KiB
521 lines
35 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qaction.cpp:52 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>QAction Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QAction Class Reference</h1>
|
|
|
|
<p>The QAction class provides an abstract user interface
|
|
action that can appear both in menus and tool bars.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qaction-h.html">qaction.h</a>></tt>
|
|
<p>Inherits <a href="qobject.html">QObject</a>.
|
|
<p>Inherited by <a href="qactiongroup.html">QActionGroup</a>.
|
|
<p><a href="qaction-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#QAction"><b>QAction</b></a> ( QObject * parent, const char * name = 0 )</li>
|
|
<li class=fn><a href="#QAction-2"><b>QAction</b></a> ( const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 )</li>
|
|
<li class=fn><a href="#QAction-3"><b>QAction</b></a> ( const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 )</li>
|
|
<li class=fn>QAction ( const QString & text, const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ) <em>(obsolete)</em></li>
|
|
<li class=fn>QAction ( const QString & text, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ) <em>(obsolete)</em></li>
|
|
<li class=fn>QAction ( QObject * parent, const char * name, bool toggle ) <em>(obsolete)</em></li>
|
|
<li class=fn><a href="#~QAction"><b>~QAction</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#setIconSet"><b>setIconSet</b></a> ( const QIconSet & )</li>
|
|
<li class=fn>QIconSet <a href="#iconSet"><b>iconSet</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const QString & )</li>
|
|
<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setMenuText"><b>setMenuText</b></a> ( const QString & )</li>
|
|
<li class=fn>QString <a href="#menuText"><b>menuText</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setToolTip"><b>setToolTip</b></a> ( const QString & )</li>
|
|
<li class=fn>QString <a href="#toolTip"><b>toolTip</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setStatusTip"><b>setStatusTip</b></a> ( const QString & )</li>
|
|
<li class=fn>QString <a href="#statusTip"><b>statusTip</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setWhatsThis"><b>setWhatsThis</b></a> ( const QString & )</li>
|
|
<li class=fn>QString <a href="#whatsThis"><b>whatsThis</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setAccel"><b>setAccel</b></a> ( const QKeySequence & key )</li>
|
|
<li class=fn>QKeySequence <a href="#accel"><b>accel</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setToggleAction"><b>setToggleAction</b></a> ( bool )</li>
|
|
<li class=fn>bool <a href="#isToggleAction"><b>isToggleAction</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isOn"><b>isOn</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isEnabled"><b>isEnabled</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isVisible"><b>isVisible</b></a> () const</li>
|
|
<li class=fn>virtual bool <a href="#addTo"><b>addTo</b></a> ( QWidget * w )</li>
|
|
<li class=fn>virtual bool <a href="#removeFrom"><b>removeFrom</b></a> ( QWidget * w )</li>
|
|
</ul>
|
|
<h2>Public Slots</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#activate"><b>activate</b></a> ()</li>
|
|
<li class=fn>void <a href="#toggle"><b>toggle</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#setOn"><b>setOn</b></a> ( bool )</li>
|
|
<li class=fn>virtual void <a href="#setEnabled"><b>setEnabled</b></a> ( bool )</li>
|
|
<li class=fn>void <a href="#setDisabled"><b>setDisabled</b></a> ( bool disable )</li>
|
|
<li class=fn>void <a href="#setVisible"><b>setVisible</b></a> ( bool )</li>
|
|
</ul>
|
|
<h2>Signals</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#activated"><b>activated</b></a> ()</li>
|
|
<li class=fn>void <a href="#toggled"><b>toggled</b></a> ( bool on )</li>
|
|
</ul>
|
|
<h2>Properties</h2>
|
|
<ul>
|
|
<li class=fn>QKeySequence <a href="#accel-prop"><b>accel</b></a> - the action's accelerator key</li>
|
|
<li class=fn>bool <a href="#enabled-prop"><b>enabled</b></a> - whether the action is enabled</li>
|
|
<li class=fn>QIconSet <a href="#iconSet-prop"><b>iconSet</b></a> - the action's icon</li>
|
|
<li class=fn>QString <a href="#menuText-prop"><b>menuText</b></a> - the action's menu text</li>
|
|
<li class=fn>bool <a href="#on-prop"><b>on</b></a> - whether a toggle action is on</li>
|
|
<li class=fn>QString <a href="#statusTip-prop"><b>statusTip</b></a> - the action's status tip</li>
|
|
<li class=fn>QString <a href="#text-prop"><b>text</b></a> - the action's descriptive text</li>
|
|
<li class=fn>bool <a href="#toggleAction-prop"><b>toggleAction</b></a> - whether the action is a toggle action</li>
|
|
<li class=fn>QString <a href="#toolTip-prop"><b>toolTip</b></a> - the action's tool tip</li>
|
|
<li class=fn>bool <a href="#visible-prop"><b>visible</b></a> - whether the action can be seen (e.g. in menus and toolbars)</li>
|
|
<li class=fn>QString <a href="#whatsThis-prop"><b>whatsThis</b></a> - the action's "What's This?" help text</li>
|
|
</ul>
|
|
<h2>Protected Members</h2>
|
|
<ul>
|
|
<li class=fn>virtual void <a href="#addedTo"><b>addedTo</b></a> ( QWidget * actionWidget, QWidget * container )</li>
|
|
<li class=fn>virtual void <a href="#addedTo-2"><b>addedTo</b></a> ( int index, QPopupMenu * menu )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The QAction class provides an abstract user interface
|
|
action that can appear both in menus and tool bars.
|
|
<p>
|
|
|
|
|
|
<p> In GUI applications many commands can be invoked via a menu
|
|
option, a toolbar button and a keyboard accelerator. Since the
|
|
same action must be performed regardless of how the action was
|
|
invoked, and since the menu and toolbar should be kept in sync, it
|
|
is useful to represent a command as an <em>action</em>. An action can be
|
|
added to a menu and a toolbar and will automatically keep them in
|
|
sync. For example, if the user presses a Bold toolbar button the
|
|
Bold menu item will automatically be checked.
|
|
<p> A QAction may contain an icon, a menu text, an accelerator, a
|
|
status text, a whats this text and a tool tip. Most of these can
|
|
be set in the constructor. They can also be set independently with
|
|
<a href="#setIconSet">setIconSet</a>(), <a href="#setText">setText</a>(), <a href="#setMenuText">setMenuText</a>(), <a href="#setToolTip">setToolTip</a>(),
|
|
<a href="#setStatusTip">setStatusTip</a>(), <a href="#setWhatsThis">setWhatsThis</a>() and <a href="#setAccel">setAccel</a>().
|
|
<p> An action may be a toggle action e.g. a Bold toolbar button, or a
|
|
command action, e.g. 'Open File' to invoke an open file dialog.
|
|
Toggle actions emit the <a href="#toggled">toggled</a>() signal when their state changes.
|
|
Both command and toggle actions emit the <a href="#activated">activated</a>() signal when
|
|
they are invoked. Use <a href="#setToggleAction">setToggleAction</a>() to set an action's toggled
|
|
status. To see if an action is a toggle action use
|
|
<a href="#isToggleAction">isToggleAction</a>(). A toggle action may be "on", <a href="#isOn">isOn</a>() returns
|
|
TRUE, or "off", isOn() returns FALSE.
|
|
<p> Actions are added to widgets (menus or toolbars) using <a href="#addTo">addTo</a>(),
|
|
and removed using <a href="#removeFrom">removeFrom</a>().
|
|
<p> Once a QAction has been created it should be added to the relevant
|
|
menu and toolbar and then connected to the slot which will perform
|
|
the action. For example:
|
|
<p>
|
|
|
|
<pre> fileOpenAction = new QAction( QPixmap( fileopen ), "&Open...",
|
|
CTRL+Key_O, this, "open" );
|
|
<a href="qobject.html#connect">connect</a>( fileOpenAction, SIGNAL( <a href="#activated">activated</a>() ) , this, SLOT( choose() ) );
|
|
</pre>
|
|
<p> We create a "File Save" action with a menu text of "&Save" and
|
|
<em>Ctrl+S</em> as the keyboard accelerator. We connect the
|
|
fileSaveAction's <a href="#activated">activated</a>() signal to our own save() slot. Note
|
|
that at this point there is no menu or toolbar action, we'll add
|
|
them next:
|
|
<p> <pre> <a href="qtoolbar.html">QToolBar</a> * fileTools = new <a href="qtoolbar.html">QToolBar</a>( this, "file operations" );
|
|
</pre><pre> fileSaveAction-><a href="#addTo">addTo</a>( fileTools );
|
|
</pre><pre> <a href="qpopupmenu.html">QPopupMenu</a> * file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
|
|
<a href="qmainwindow.html#menuBar">menuBar</a>()->insertItem( "&File", file );
|
|
</pre><pre> fileSaveAction-><a href="#addTo">addTo</a>( file );
|
|
</pre>
|
|
<p> We create a toolbar and add our fileSaveAction to it. Similarly we
|
|
create a menu, add a top-level menu item, and add our
|
|
fileSaveAction.
|
|
<p> We recommend that actions are created as children of the window
|
|
that they are used in. In most cases actions will be children of
|
|
the application's main window.
|
|
<p> To prevent recursion, don't create an action as a child of a
|
|
widget that the action is later added to.
|
|
<p>See also <a href="application.html">Main Window and Related Classes</a> and <a href="basic.html">Basic Widgets</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="QAction"></a>QAction::QAction ( <a href="qobject.html">QObject</a> * parent, const char * name = 0 )
|
|
</h3>
|
|
Constructs an action called <em>name</em> with parent <em>parent</em>.
|
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">QActionGroup</a>, the new action inserts itself into
|
|
<em>parent</em>.
|
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
|
a widget, or an action group whose parent is a widget.
|
|
<p> <b>Warning:</b> To prevent recursion, don't create an action as a child
|
|
of a widget that the action is later added to.
|
|
|
|
<h3 class=fn><a name="QAction-2"></a>QAction::QAction ( const <a href="qstring.html">QString</a> & menuText, <a href="qkeysequence.html">QKeySequence</a> accel, <a href="qobject.html">QObject</a> * parent, const char * name = 0 )
|
|
</h3>
|
|
This constructor results in an icon-less action with the the menu
|
|
text <em>menuText</em> and keyboard accelerator <em>accel</em>. It is a child
|
|
of <em>parent</em> and called <em>name</em>.
|
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">QActionGroup</a>, the action automatically becomes
|
|
a member of it.
|
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
|
a widget, or an action group whose parent is a widget.
|
|
<p> The action uses a stripped version of <em>menuText</em> (e.g. "&Menu
|
|
Option..." becomes "Menu Option") as descriptive text for
|
|
toolbuttons. You can override this by setting a specific
|
|
description with <a href="#setText">setText</a>(). The same text and <em>accel</em> will be
|
|
used for tool tips and status tips unless you provide text for
|
|
these using <a href="#setToolTip">setToolTip</a>() and <a href="#setStatusTip">setStatusTip</a>().
|
|
<p> Call <a href="#setToggleAction">setToggleAction</a>(TRUE) to make the action a toggle action.
|
|
<p> <b>Warning:</b> To prevent recursion, don't create an action as a child
|
|
of a widget that the action is later added to.
|
|
|
|
<h3 class=fn><a name="QAction-3"></a>QAction::QAction ( const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qstring.html">QString</a> & menuText, <a href="qkeysequence.html">QKeySequence</a> accel, <a href="qobject.html">QObject</a> * parent, const char * name = 0 )
|
|
</h3>
|
|
This constructor creates an action with the following properties:
|
|
the icon or iconset <em>icon</em>, the menu text <em>menuText</em> and
|
|
keyboard accelerator <em>accel</em>. It is a child of <em>parent</em> and
|
|
called <em>name</em>.
|
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">QActionGroup</a>, the action automatically becomes
|
|
a member of it.
|
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
|
a widget, or an action group whose parent is a widget.
|
|
<p> The action uses a stripped version of <em>menuText</em> (e.g. "&Menu
|
|
Option..." becomes "Menu Option") as descriptive text for
|
|
toolbuttons. You can override this by setting a specific
|
|
description with <a href="#setText">setText</a>(). The same text and <em>accel</em> will be
|
|
used for tool tips and status tips unless you provide text for
|
|
these using <a href="#setToolTip">setToolTip</a>() and <a href="#setStatusTip">setStatusTip</a>().
|
|
<p> Call <a href="#setToggleAction">setToggleAction</a>(TRUE) to make the action a toggle action.
|
|
<p> <b>Warning:</b> To prevent recursion, don't create an action as a child
|
|
of a widget that the action is later added to.
|
|
|
|
<h3 class=fn><a name="QAction-4"></a>QAction::QAction ( const <a href="qstring.html">QString</a> & text, const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qstring.html">QString</a> & menuText, <a href="qkeysequence.html">QKeySequence</a> accel, <a href="qobject.html">QObject</a> * parent, const char * name = 0, bool toggle = FALSE )
|
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> This constructor creates an action with the following properties:
|
|
the description <em>text</em>, the icon or iconset <em>icon</em>, the menu
|
|
text <em>menuText</em> and keyboard accelerator <em>accel</em>. It is a child
|
|
of <em>parent</em> and called <em>name</em>. If <em>toggle</em> is TRUE the action
|
|
will be a toggle action, otherwise it will be a command action.
|
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">QActionGroup</a>, the action automatically becomes
|
|
a member of it.
|
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
|
a widget, or an action group whose parent is a widget.
|
|
<p> The <em>text</em> and <em>accel</em> will be used for tool tips and status
|
|
tips unless you provide specific text for these using <a href="#setToolTip">setToolTip</a>()
|
|
and <a href="#setStatusTip">setStatusTip</a>().
|
|
|
|
<h3 class=fn><a name="QAction-5"></a>QAction::QAction ( const <a href="qstring.html">QString</a> & text, const <a href="qstring.html">QString</a> & menuText, <a href="qkeysequence.html">QKeySequence</a> accel, <a href="qobject.html">QObject</a> * parent, const char * name = 0, bool toggle = FALSE )
|
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> This constructor results in an icon-less action with the
|
|
description <em>text</em>, the menu text <em>menuText</em> and the keyboard
|
|
accelerator <em>accel</em>. Its parent is <em>parent</em> and it is called <em>name</em>. If <em>toggle</em> is TRUE the action will be a toggle action,
|
|
otherwise it will be a command action.
|
|
<p> The action automatically becomes a member of <em>parent</em> if <em>parent</em> is a <a href="qactiongroup.html">QActionGroup</a>.
|
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
|
a widget, or an action group whose parent is a widget.
|
|
<p> The <em>text</em> and <em>accel</em> will be used for tool tips and status
|
|
tips unless you provide specific text for these using <a href="#setToolTip">setToolTip</a>()
|
|
and <a href="#setStatusTip">setStatusTip</a>().
|
|
|
|
<h3 class=fn><a name="QAction-6"></a>QAction::QAction ( <a href="qobject.html">QObject</a> * parent, const char * name, bool toggle )
|
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Constructs an action called <em>name</em> with parent <em>parent</em>.
|
|
<p> If <em>toggle</em> is TRUE the action will be a toggle action, otherwise
|
|
it will be a command action.
|
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">QActionGroup</a>, the new action inserts itself into
|
|
<em>parent</em>.
|
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
|
a widget, or an action group whose parent is a widget.
|
|
|
|
<h3 class=fn><a name="~QAction"></a>QAction::~QAction ()
|
|
</h3>
|
|
Destroys the object and frees allocated resources.
|
|
|
|
<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> <a name="accel"></a>QAction::accel () const
|
|
</h3><p>Returns the action's accelerator key.
|
|
See the <a href="qaction.html#accel-prop">"accel"</a> property for details.
|
|
<h3 class=fn>void <a name="activate"></a>QAction::activate ()<tt> [slot]</tt>
|
|
</h3>
|
|
Activates the action and executes all connected slots.
|
|
This only works for actions that are not toggle action.
|
|
<p> <p>See also <a href="#toggle">toggle</a>().
|
|
|
|
<h3 class=fn>void <a name="activated"></a>QAction::activated ()<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted when an action is activated by the user,
|
|
e.g. when the user clicks a menu option or a toolbar button or
|
|
presses an action's accelerator key combination.
|
|
<p> Connect to this signal for command actions. Connect to the
|
|
<a href="#toggled">toggled</a>() signal for toggle actions.
|
|
|
|
<p>Examples: <a href="qaction-application-example.html#x1123">action/application.cpp</a>, <a href="canvas-chart-example.html#x2869">chart/chartform.cpp</a>, and <a href="themes-example.html#x316">themes/themes.cpp</a>.
|
|
<h3 class=fn>bool <a name="addTo"></a>QAction::addTo ( <a href="qwidget.html">QWidget</a> * w )<tt> [virtual]</tt>
|
|
</h3>
|
|
Adds this action to widget <em>w</em>.
|
|
<p> Currently actions may be added to <a href="qtoolbar.html">QToolBar</a> and <a href="qpopupmenu.html">QPopupMenu</a> widgets.
|
|
<p> An action added to a tool bar is automatically displayed as a tool
|
|
button; an action added to a pop up menu appears as a menu option.
|
|
<p> <a href="#addTo">addTo</a>() returns TRUE if the action was added successfully and
|
|
FALSE otherwise. (If <em>w</em> is not a QToolBar or QPopupMenu the
|
|
action will not be added and FALSE will be returned.)
|
|
<p> <p>See also <a href="#removeFrom">removeFrom</a>().
|
|
|
|
<p>Examples: <a href="qaction-application-example.html#x1124">action/application.cpp</a>, <a href="toggleaction-example.html#x2971">action/toggleaction/toggleaction.cpp</a>, and <a href="canvas-chart-example.html#x2870">chart/chartform.cpp</a>.
|
|
<p>Reimplemented in <a href="qactiongroup.html#addTo">QActionGroup</a>.
|
|
<h3 class=fn>void <a name="addedTo"></a>QAction::addedTo ( <a href="qwidget.html">QWidget</a> * actionWidget, <a href="qwidget.html">QWidget</a> * container )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This function is called from the <a href="#addTo">addTo</a>() function when it has
|
|
created a widget (<em>actionWidget</em>) for the action in the <em>container</em>.
|
|
|
|
<h3 class=fn>void <a name="addedTo-2"></a>QAction::addedTo ( int index, <a href="qpopupmenu.html">QPopupMenu</a> * menu )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> This function is called from the <a href="#addTo">addTo</a>() function when it has
|
|
created a menu item at the index position <em>index</em> in the popup
|
|
menu <em>menu</em>.
|
|
|
|
<h3 class=fn><a href="qiconset.html">QIconSet</a> <a name="iconSet"></a>QAction::iconSet () const
|
|
</h3><p>Returns the action's icon.
|
|
See the <a href="qaction.html#iconSet-prop">"iconSet"</a> property for details.
|
|
<h3 class=fn>bool <a name="isEnabled"></a>QAction::isEnabled () const
|
|
</h3><p>Returns TRUE if the action is enabled; otherwise returns FALSE.
|
|
See the <a href="qaction.html#enabled-prop">"enabled"</a> property for details.
|
|
<h3 class=fn>bool <a name="isOn"></a>QAction::isOn () const
|
|
</h3><p>Returns TRUE if a toggle action is on; otherwise returns FALSE.
|
|
See the <a href="qaction.html#on-prop">"on"</a> property for details.
|
|
<h3 class=fn>bool <a name="isToggleAction"></a>QAction::isToggleAction () const
|
|
</h3><p>Returns TRUE if the action is a toggle action; otherwise returns FALSE.
|
|
See the <a href="qaction.html#toggleAction-prop">"toggleAction"</a> property for details.
|
|
<h3 class=fn>bool <a name="isVisible"></a>QAction::isVisible () const
|
|
</h3><p>Returns TRUE if the action can be seen (e.g. in menus and toolbars); otherwise returns FALSE.
|
|
See the <a href="qaction.html#visible-prop">"visible"</a> property for details.
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="menuText"></a>QAction::menuText () const
|
|
</h3><p>Returns the action's menu text.
|
|
See the <a href="qaction.html#menuText-prop">"menuText"</a> property for details.
|
|
<h3 class=fn>bool <a name="removeFrom"></a>QAction::removeFrom ( <a href="qwidget.html">QWidget</a> * w )<tt> [virtual]</tt>
|
|
</h3>
|
|
Removes the action from widget <em>w</em>.
|
|
<p> Returns TRUE if the action was removed successfully; otherwise
|
|
returns FALSE.
|
|
<p> <p>See also <a href="#addTo">addTo</a>().
|
|
|
|
<h3 class=fn>void <a name="setAccel"></a>QAction::setAccel ( const <a href="qkeysequence.html">QKeySequence</a> & key )<tt> [virtual]</tt>
|
|
</h3><p>Sets the action's accelerator key to <em>key</em>.
|
|
See the <a href="qaction.html#accel-prop">"accel"</a> property for details.
|
|
<h3 class=fn>void <a name="setDisabled"></a>QAction::setDisabled ( bool disable )<tt> [slot]</tt>
|
|
</h3>
|
|
Disables the action if <em>disable</em> is TRUE; otherwise
|
|
enables the action.
|
|
<p> See the <a href="#enabled-prop">enabled</a> documentation for more information.
|
|
|
|
<h3 class=fn>void <a name="setEnabled"></a>QAction::setEnabled ( bool )<tt> [virtual slot]</tt>
|
|
</h3><p>Sets whether the action is enabled.
|
|
See the <a href="qaction.html#enabled-prop">"enabled"</a> property for details.
|
|
<h3 class=fn>void <a name="setIconSet"></a>QAction::setIconSet ( const <a href="qiconset.html">QIconSet</a> & )<tt> [virtual]</tt>
|
|
</h3><p>Sets the action's icon.
|
|
See the <a href="qaction.html#iconSet-prop">"iconSet"</a> property for details.
|
|
<h3 class=fn>void <a name="setMenuText"></a>QAction::setMenuText ( const <a href="qstring.html">QString</a> & )<tt> [virtual]</tt>
|
|
</h3><p>Sets the action's menu text.
|
|
See the <a href="qaction.html#menuText-prop">"menuText"</a> property for details.
|
|
<h3 class=fn>void <a name="setOn"></a>QAction::setOn ( bool )<tt> [virtual slot]</tt>
|
|
</h3><p>Sets whether a toggle action is on.
|
|
See the <a href="qaction.html#on-prop">"on"</a> property for details.
|
|
<h3 class=fn>void <a name="setStatusTip"></a>QAction::setStatusTip ( const <a href="qstring.html">QString</a> & )<tt> [virtual]</tt>
|
|
</h3><p>Sets the action's status tip.
|
|
See the <a href="qaction.html#statusTip-prop">"statusTip"</a> property for details.
|
|
<h3 class=fn>void <a name="setText"></a>QAction::setText ( const <a href="qstring.html">QString</a> & )<tt> [virtual]</tt>
|
|
</h3><p>Sets the action's descriptive text.
|
|
See the <a href="qaction.html#text-prop">"text"</a> property for details.
|
|
<h3 class=fn>void <a name="setToggleAction"></a>QAction::setToggleAction ( bool )<tt> [virtual]</tt>
|
|
</h3><p>Sets whether the action is a toggle action.
|
|
See the <a href="qaction.html#toggleAction-prop">"toggleAction"</a> property for details.
|
|
<h3 class=fn>void <a name="setToolTip"></a>QAction::setToolTip ( const <a href="qstring.html">QString</a> & )<tt> [virtual]</tt>
|
|
</h3><p>Sets the action's tool tip.
|
|
See the <a href="qaction.html#toolTip-prop">"toolTip"</a> property for details.
|
|
<h3 class=fn>void <a name="setVisible"></a>QAction::setVisible ( bool )<tt> [slot]</tt>
|
|
</h3><p>Sets whether the action can be seen (e.g. in menus and toolbars).
|
|
See the <a href="qaction.html#visible-prop">"visible"</a> property for details.
|
|
<h3 class=fn>void <a name="setWhatsThis"></a>QAction::setWhatsThis ( const <a href="qstring.html">QString</a> & )<tt> [virtual]</tt>
|
|
</h3><p>Sets the action's "What's This?" help text.
|
|
See the <a href="qaction.html#whatsThis-prop">"whatsThis"</a> property for details.
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="statusTip"></a>QAction::statusTip () const
|
|
</h3><p>Returns the action's status tip.
|
|
See the <a href="qaction.html#statusTip-prop">"statusTip"</a> property for details.
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QAction::text () const
|
|
</h3><p>Returns the action's descriptive text.
|
|
See the <a href="qaction.html#text-prop">"text"</a> property for details.
|
|
<h3 class=fn>void <a name="toggle"></a>QAction::toggle ()<tt> [slot]</tt>
|
|
</h3>
|
|
Toggles the state of a toggle action.
|
|
<p> <p>See also <a href="#on-prop">on</a>, <a href="#activate">activate</a>(), <a href="#toggled">toggled</a>(), and <a href="#toggleAction-prop">toggleAction</a>.
|
|
|
|
<h3 class=fn>void <a name="toggled"></a>QAction::toggled ( bool on )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted when a toggle action changes state; command
|
|
actions and <a href="qactiongroup.html">QActionGroup</a>s don't emit <a href="#toggled">toggled</a>().
|
|
<p> The <em>on</em> argument denotes the new state: If <em>on</em> is TRUE the
|
|
toggle action is switched on, and if <em>on</em> is FALSE the toggle
|
|
action is switched off.
|
|
<p> To trigger a user command depending on whether a toggle action has
|
|
been switched on or off connect it to a slot that takes a bool to
|
|
indicate the state, e.g.
|
|
<p>
|
|
|
|
<pre> <a href="qmainwindow.html">QMainWindow</a> * window = new <a href="qmainwindow.html">QMainWindow</a>;
|
|
</pre><pre> QAction * labelonoffaction = new QAction( window, "labelonoff" );
|
|
</pre><pre> <a name="x2108"></a> QObject::<a href="qobject.html#connect">connect</a>( labelonoffaction, SIGNAL( <a href="#toggled">toggled</a>( bool ) ),
|
|
<a name="x2109"></a> window, SLOT( <a href="qmainwindow.html#setUsesTextLabel">setUsesTextLabel</a>( bool ) ) );
|
|
</pre>
|
|
<p> <p>See also <a href="#activated">activated</a>(), <a href="#toggleAction-prop">toggleAction</a>, and <a href="#on-prop">on</a>.
|
|
|
|
<p>Example: <a href="qaction.html#x2108">action/toggleaction/toggleaction.cpp</a>.
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="toolTip"></a>QAction::toolTip () const
|
|
</h3><p>Returns the action's tool tip.
|
|
See the <a href="qaction.html#toolTip-prop">"toolTip"</a> property for details.
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="whatsThis"></a>QAction::whatsThis () const
|
|
</h3><p>Returns the action's "What's This?" help text.
|
|
See the <a href="qaction.html#whatsThis-prop">"whatsThis"</a> property for details.
|
|
<hr><h2>Property Documentation</h2>
|
|
<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> <a name="accel-prop"></a>accel</h3>
|
|
<p>This property holds the action's accelerator key.
|
|
<p>The keycodes can be found in <a href="qt.html#Key-enum">Qt::Key</a> and <a href="qt.html#Modifier-enum">Qt::Modifier</a>. There
|
|
is no default accelerator key.
|
|
|
|
<p>Set this property's value with <a href="#setAccel">setAccel</a>() and get this property's value with <a href="#accel">accel</a>().
|
|
<h3 class=fn>bool <a name="enabled-prop"></a>enabled</h3>
|
|
<p>This property holds whether the action is enabled.
|
|
<p>Disabled actions can't be chosen by the user. They don't disappear
|
|
from the menu/tool bar but are displayed in a way which indicates
|
|
that they are unavailable, e.g. they might be displayed grayed
|
|
out.
|
|
<p> What's this? help on disabled actions is still available provided
|
|
the <a href="#whatsThis-prop">QAction::whatsThis</a> property is set.
|
|
|
|
<p>Set this property's value with <a href="#setEnabled">setEnabled</a>() and get this property's value with <a href="#isEnabled">isEnabled</a>().
|
|
<h3 class=fn><a href="qiconset.html">QIconSet</a> <a name="iconSet-prop"></a>iconSet</h3>
|
|
<p>This property holds the action's icon.
|
|
<p>The icon is used as the tool button icon and in the menu to the
|
|
left of the menu text. There is no default icon.
|
|
<p> If a null icon (<a href="qiconset.html#isNull">QIconSet::isNull</a>() is passed into this function,
|
|
the icon of the action is cleared.
|
|
<p> (See the action/toggleaction/toggleaction.cpp example.)
|
|
<p>
|
|
<p>Set this property's value with <a href="#setIconSet">setIconSet</a>() and get this property's value with <a href="#iconSet">iconSet</a>().
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="menuText-prop"></a>menuText</h3>
|
|
<p>This property holds the action's menu text.
|
|
<p>If the action is added to a menu the menu option will consist of
|
|
the icon (if there is one), the menu text and the accelerator (if
|
|
there is one). If the menu text is not explicitly set in the
|
|
constructor or by using <a href="#setMenuText">setMenuText</a>() the action's description
|
|
text will be used as the menu text. There is no default menu text.
|
|
<p> <p>See also <a href="#text-prop">text</a>.
|
|
|
|
<p>Set this property's value with <a href="#setMenuText">setMenuText</a>() and get this property's value with <a href="#menuText">menuText</a>().
|
|
<h3 class=fn>bool <a name="on-prop"></a>on</h3>
|
|
<p>This property holds whether a toggle action is on.
|
|
<p>This property is always on (TRUE) for command actions and
|
|
<a href="qactiongroup.html">QActionGroup</a>s; <a href="#setOn">setOn</a>() has no effect on them. For action's
|
|
where <a href="#isToggleAction">isToggleAction</a>() is TRUE, this property's default value is
|
|
off (FALSE).
|
|
<p> <p>See also <a href="#toggleAction-prop">toggleAction</a>.
|
|
|
|
<p>Set this property's value with <a href="#setOn">setOn</a>() and get this property's value with <a href="#isOn">isOn</a>().
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="statusTip-prop"></a>statusTip</h3>
|
|
<p>This property holds the action's status tip.
|
|
<p>The statusTip is displayed on all status bars that this action's
|
|
toplevel parent widget provides.
|
|
<p> If no status tip is defined, the action uses the tool tip text.
|
|
<p> There is no default statusTip text.
|
|
<p> <p>See also <a href="#statusTip-prop">statusTip</a> and <a href="#toolTip-prop">toolTip</a>.
|
|
|
|
<p>Set this property's value with <a href="#setStatusTip">setStatusTip</a>() and get this property's value with <a href="#statusTip">statusTip</a>().
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="text-prop"></a>text</h3>
|
|
<p>This property holds the action's descriptive text.
|
|
<p>If <a href="qmainwindow.html#usesTextLabel-prop">QMainWindow::usesTextLabel</a> is TRUE, the text appears as a
|
|
label in the relevant tool button. It also serves as the default
|
|
text in menus and tool tips if these have not been specifically
|
|
defined. There is no default text.
|
|
<p> <p>See also <a href="#menuText-prop">menuText</a>, <a href="#toolTip-prop">toolTip</a>, and <a href="#statusTip-prop">statusTip</a>.
|
|
|
|
<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
|
|
<h3 class=fn>bool <a name="toggleAction-prop"></a>toggleAction</h3>
|
|
<p>This property holds whether the action is a toggle action.
|
|
<p>A toggle action is one which has an on/off state. For example a
|
|
Bold toolbar button is 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. This property's default is FALSE.
|
|
<p> 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
|
|
<a href="qactiongroup.html">QActionGroup</a> with the <a href="qactiongroup.html#exclusive-prop">QActionGroup::exclusive</a> property set to
|
|
TRUE.
|
|
|
|
<p>Set this property's value with <a href="#setToggleAction">setToggleAction</a>() and get this property's value with <a href="#isToggleAction">isToggleAction</a>().
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="toolTip-prop"></a>toolTip</h3>
|
|
<p>This property holds the action's tool tip.
|
|
<p>This text is used for the tool tip. If no status tip has been set
|
|
the tool tip will be used for the status tip.
|
|
<p> If no tool tip is specified the action's text is used, and if that
|
|
hasn't been specified the description text is used as the tool tip
|
|
text.
|
|
<p> There is no default tool tip text.
|
|
<p> <p>See also <a href="#statusTip-prop">statusTip</a> and <a href="#accel-prop">accel</a>.
|
|
|
|
<p>Set this property's value with <a href="#setToolTip">setToolTip</a>() and get this property's value with <a href="#toolTip">toolTip</a>().
|
|
<h3 class=fn>bool <a name="visible-prop"></a>visible</h3>
|
|
<p>This property holds whether the action can be seen (e.g. in menus and toolbars).
|
|
<p>If <em>visible</em> is TRUE the action can be seen (e.g. in menus and
|
|
toolbars) and chosen by the user; if <em>visible</em> is FALSE the
|
|
action cannot be seen or chosen by the user.
|
|
<p> Actions which are not visible are <em>not</em> grayed out; they do not
|
|
appear at all.
|
|
|
|
<p>Set this property's value with <a href="#setVisible">setVisible</a>() and get this property's value with <a href="#isVisible">isVisible</a>().
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="whatsThis-prop"></a>whatsThis</h3>
|
|
<p>This property holds the action's "What's This?" help text.
|
|
<p>The whats this text is used to provide a brief description of the
|
|
action. The text may contain rich text (HTML-like tags -- see
|
|
<a href="qstylesheet.html">QStyleSheet</a> for the list of supported tags). There is no default
|
|
"What's This" text.
|
|
<p> <p>See also <a href="qwhatsthis.html">QWhatsThis</a>.
|
|
|
|
<p>Set this property's value with <a href="#setWhatsThis">setWhatsThis</a>() and get this property's value with <a href="#whatsThis">whatsThis</a>().
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">Qt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>Qt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|