~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qaction.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/kernel/qaction.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QAction Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QAction Class Reference</h1>
 
21
<p>The QAction class provides an abstract user interface action that can be inserted into widgets. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QAction&gt;</pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
 
23
<p>Inherits <a href="qobject.html">QObject</a>.</p>
 
24
<p>Inherited by <a href="qmenuitem.html">QMenuItem</a>.</p>
 
25
<ul>
 
26
<li><a href="qaction-members.html">List of all members, including inherited members</a></li>
 
27
<li><a href="qaction-qt3.html">Qt 3 support members</a></li>
 
28
</ul>
 
29
<a name="public-types"></a>
 
30
<h3>Public Types</h3>
 
31
<ul>
 
32
<li><div class="fn"/>enum <b><a href="qaction.html#ActionEvent-enum">ActionEvent</a></b> { Trigger, Hover }</li>
 
33
</ul>
 
34
<a name="properties"></a>
 
35
<h3>Properties</h3>
 
36
<table width="100%" border="0" cellpadding="0" cellspacing="0">
 
37
<tr><td width="45%" valign="top"><ul>
 
38
<li><div class="fn"/><b><a href="qaction.html#checkable-prop">checkable</a></b> : bool</li>
 
39
<li><div class="fn"/><b><a href="qaction.html#checked-prop">checked</a></b> : bool</li>
 
40
<li><div class="fn"/><b><a href="qaction.html#enabled-prop">enabled</a></b> : bool</li>
 
41
<li><div class="fn"/><b><a href="qaction.html#font-prop">font</a></b> : QFont</li>
 
42
<li><div class="fn"/><b><a href="qaction.html#icon-prop">icon</a></b> : QIcon</li>
 
43
<li><div class="fn"/><b><a href="qaction.html#iconText-prop">iconText</a></b> : QString</li>
 
44
<li><div class="fn"/><b><a href="qaction.html#shortcut-prop">shortcut</a></b> : QKeySequence</li>
 
45
</ul></td><td valign="top"><ul>
 
46
<li><div class="fn"/><b><a href="qaction.html#shortcutContext-prop">shortcutContext</a></b> : Qt::ShortcutContext</li>
 
47
<li><div class="fn"/><b><a href="qaction.html#statusTip-prop">statusTip</a></b> : QString</li>
 
48
<li><div class="fn"/><b><a href="qaction.html#text-prop">text</a></b> : QString</li>
 
49
<li><div class="fn"/><b><a href="qaction.html#toolTip-prop">toolTip</a></b> : QString</li>
 
50
<li><div class="fn"/><b><a href="qaction.html#visible-prop">visible</a></b> : bool</li>
 
51
<li><div class="fn"/><b><a href="qaction.html#whatsThis-prop">whatsThis</a></b> : QString</li>
 
52
</ul>
 
53
</td></tr>
 
54
</table>
 
55
<ul>
 
56
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
57
</ul>
 
58
<a name="public-functions"></a>
 
59
<h3>Public Functions</h3>
 
60
<ul>
 
61
<li><div class="fn"/><b><a href="qaction.html#QAction">QAction</a></b> ( QObject * <i>parent</i> )</li>
 
62
<li><div class="fn"/><b><a href="qaction.html#QAction-2">QAction</a></b> ( const QString &amp; <i>text</i>, QObject * <i>parent</i> )</li>
 
63
<li><div class="fn"/><b><a href="qaction.html#QAction-3">QAction</a></b> ( const QIcon &amp; <i>icon</i>, const QString &amp; <i>text</i>, QObject * <i>parent</i> )</li>
 
64
<li><div class="fn"/><b><a href="qaction.html#dtor.QAction">~QAction</a></b> ()</li>
 
65
<li><div class="fn"/>QActionGroup * <b><a href="qaction.html#actionGroup">actionGroup</a></b> () const</li>
 
66
<li><div class="fn"/>void <b><a href="qaction.html#activate">activate</a></b> ( ActionEvent <i>event</i> )</li>
 
67
<li><div class="fn"/>QVariant <b><a href="qaction.html#data">data</a></b> () const</li>
 
68
<li><div class="fn"/>QFont <b><a href="qaction.html#font-prop">font</a></b> () const</li>
 
69
<li><div class="fn"/>QIcon <b><a href="qaction.html#icon-prop">icon</a></b> () const</li>
 
70
<li><div class="fn"/>QString <b><a href="qaction.html#iconText-prop">iconText</a></b> () const</li>
 
71
<li><div class="fn"/>bool <b><a href="qaction.html#checkable-prop">isCheckable</a></b> () const</li>
 
72
<li><div class="fn"/>bool <b><a href="qaction.html#checked-prop">isChecked</a></b> () const</li>
 
73
<li><div class="fn"/>bool <b><a href="qaction.html#enabled-prop">isEnabled</a></b> () const</li>
 
74
<li><div class="fn"/>bool <b><a href="qaction.html#isSeparator">isSeparator</a></b> () const</li>
 
75
<li><div class="fn"/>bool <b><a href="qaction.html#visible-prop">isVisible</a></b> () const</li>
 
76
<li><div class="fn"/>QMenu * <b><a href="qaction.html#menu">menu</a></b> () const</li>
 
77
<li><div class="fn"/>QWidget * <b><a href="qaction.html#parentWidget">parentWidget</a></b> () const</li>
 
78
<li><div class="fn"/>void <b><a href="qaction.html#setActionGroup">setActionGroup</a></b> ( QActionGroup * <i>group</i> )</li>
 
79
<li><div class="fn"/>void <b><a href="qaction.html#checkable-prop">setCheckable</a></b> ( bool )</li>
 
80
<li><div class="fn"/>void <b><a href="qaction.html#setData">setData</a></b> ( const QVariant &amp; <i>data</i> )</li>
 
81
<li><div class="fn"/>void <b><a href="qaction.html#font-prop">setFont</a></b> ( const QFont &amp; <i>font</i> )</li>
 
82
<li><div class="fn"/>void <b><a href="qaction.html#icon-prop">setIcon</a></b> ( const QIcon &amp; <i>icon</i> )</li>
 
83
<li><div class="fn"/>void <b><a href="qaction.html#iconText-prop">setIconText</a></b> ( const QString &amp; <i>text</i> )</li>
 
84
<li><div class="fn"/>void <b><a href="qaction.html#setMenu">setMenu</a></b> ( QMenu * <i>menu</i> )</li>
 
85
<li><div class="fn"/>void <b><a href="qaction.html#setSeparator">setSeparator</a></b> ( bool <i>b</i> )</li>
 
86
<li><div class="fn"/>void <b><a href="qaction.html#shortcut-prop">setShortcut</a></b> ( const QKeySequence &amp; <i>shortcut</i> )</li>
 
87
<li><div class="fn"/>void <b><a href="qaction.html#shortcutContext-prop">setShortcutContext</a></b> ( Qt::ShortcutContext <i>context</i> )</li>
 
88
<li><div class="fn"/>void <b><a href="qaction.html#statusTip-prop">setStatusTip</a></b> ( const QString &amp; <i>statusTip</i> )</li>
 
89
<li><div class="fn"/>void <b><a href="qaction.html#text-prop">setText</a></b> ( const QString &amp; <i>text</i> )</li>
 
90
<li><div class="fn"/>void <b><a href="qaction.html#toolTip-prop">setToolTip</a></b> ( const QString &amp; <i>tip</i> )</li>
 
91
<li><div class="fn"/>void <b><a href="qaction.html#whatsThis-prop">setWhatsThis</a></b> ( const QString &amp; <i>what</i> )</li>
 
92
<li><div class="fn"/>QKeySequence <b><a href="qaction.html#shortcut-prop">shortcut</a></b> () const</li>
 
93
<li><div class="fn"/>Qt::ShortcutContext <b><a href="qaction.html#shortcutContext-prop">shortcutContext</a></b> () const</li>
 
94
<li><div class="fn"/>bool <b><a href="qaction.html#showStatusText">showStatusText</a></b> ( QWidget * <i>widget</i> = 0 )</li>
 
95
<li><div class="fn"/>QString <b><a href="qaction.html#statusTip-prop">statusTip</a></b> () const</li>
 
96
<li><div class="fn"/>QString <b><a href="qaction.html#text-prop">text</a></b> () const</li>
 
97
<li><div class="fn"/>QString <b><a href="qaction.html#toolTip-prop">toolTip</a></b> () const</li>
 
98
<li><div class="fn"/>QString <b><a href="qaction.html#whatsThis-prop">whatsThis</a></b> () const</li>
 
99
</ul>
 
100
<ul>
 
101
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
102
</ul>
 
103
<a name="public-slots"></a>
 
104
<h3>Public Slots</h3>
 
105
<ul>
 
106
<li><div class="fn"/>void <b><a href="qaction.html#hover">hover</a></b> ()</li>
 
107
<li><div class="fn"/>void <b><a href="qaction.html#checked-prop">setChecked</a></b> ( bool )</li>
 
108
<li><div class="fn"/>void <b><a href="qaction.html#setDisabled">setDisabled</a></b> ( bool <i>b</i> )</li>
 
109
<li><div class="fn"/>void <b><a href="qaction.html#enabled-prop">setEnabled</a></b> ( bool )</li>
 
110
<li><div class="fn"/>void <b><a href="qaction.html#visible-prop">setVisible</a></b> ( bool )</li>
 
111
<li><div class="fn"/>void <b><a href="qaction.html#toggle">toggle</a></b> ()</li>
 
112
<li><div class="fn"/>void <b><a href="qaction.html#trigger">trigger</a></b> ()</li>
 
113
</ul>
 
114
<ul>
 
115
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
116
</ul>
 
117
<a name="signals"></a>
 
118
<h3>Signals</h3>
 
119
<ul>
 
120
<li><div class="fn"/>void <b><a href="qaction.html#changed">changed</a></b> ()</li>
 
121
<li><div class="fn"/>void <b><a href="qaction.html#hovered">hovered</a></b> ()</li>
 
122
<li><div class="fn"/>void <b><a href="qaction.html#toggled">toggled</a></b> ( bool <i>checked</i> )</li>
 
123
<li><div class="fn"/>void <b><a href="qaction.html#triggered">triggered</a></b> ( bool <i>checked</i> = false )</li>
 
124
</ul>
 
125
<ul>
 
126
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
127
</ul>
 
128
<h3>Additional Inherited Members</h3>
 
129
<ul>
 
130
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
131
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
132
</ul>
 
133
<a name="details"></a>
 
134
<hr />
 
135
<h2>Detailed Description</h2>
 
136
<p>The QAction class provides an abstract user interface action that can be inserted into widgets.</p>
 
137
<p>In applications many common commands can be invoked via menus, toolbar buttons, and keyboard shortcuts. Since the user expects each command to be performed in the same way, regardless of the user interface used, it is useful to represent each command as an <i>action</i>.</p>
 
138
<p>Actions can be added to menus and toolbars, and will automatically keep them in sync. For example, in a word processor, if the user presses a Bold toolbar button, the Bold menu item will automatically be checked.</p>
 
139
<p>Actions can be created as independent objects, but they may also be created during the construction of menus; the <a href="qmenu.html">QMenu</a> class contains convenience functions for creating actions suitable for use as menu items.</p>
 
140
<p>A QAction may contain an icon, menu text, a shortcut, status text, &quot;What's This?&quot; text, and a tool tip. Most of these can be set in the constructor. They can also be set independently with <a href="qaction.html#icon-prop">setIcon</a>(), <a href="qaction.html#text-prop">setText</a>(), <a href="qaction.html#iconText-prop">setIconText</a>(), <a href="qaction.html#shortcut-prop">setShortcut</a>(), <a href="qaction.html#statusTip-prop">setStatusTip</a>(), <a href="qaction.html#whatsThis-prop">setWhatsThis</a>(), and <a href="qaction.html#toolTip-prop">setToolTip</a>(). For menu items, it is possible to set an individual font with <a href="qaction.html#font-prop">setFont</a>().</p>
 
141
<p>Actions are added to widgets using <a href="qwidget.html#addAction">QWidget::addAction</a>().</p>
 
142
<p>Once a QAction has been created it should be added to the relevant menu and toolbar, then connected to the slot which will perform the action. For example:</p>
 
143
<pre>&nbsp;       openAct = new QAction(QIcon(&quot;:/images/open.png&quot;), tr(&quot;&amp;Open...&quot;), this);
 
144
        openAct-&gt;setShortcut(tr(&quot;Ctrl+O&quot;));
 
145
        openAct-&gt;setStatusTip(tr(&quot;Open an existing file&quot;));
 
146
        connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
 
147
 
 
148
        fileMenu-&gt;addAction(openAct);
 
149
        fileToolBar-&gt;addAction(openAct);</pre>
 
150
<p>We recommend that actions are created as children of the window they are used in. In most cases actions will be children of the application's main window.</p>
 
151
<hr />
 
152
<h2>Member Type Documentation</h2>
 
153
<h3 class="fn"><a name="ActionEvent-enum"></a>enum QAction::ActionEvent</h3>
 
154
<p>This enum type is used when calling <a href="qaction.html#activate">QAction::activate</a>()</p>
 
155
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
156
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
157
<tr><td valign="top"><tt>QAction::Trigger</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">this will cause the <a href="qaction.html#triggered">QAction::triggered</a>() signal to be emitted.</td></tr>
 
158
<tr><td valign="top"><tt>QAction::Hover</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">this will cause the <a href="qaction.html#hovered">QAction::hovered</a>() signal to be emitted.</td></tr>
 
159
</table>
 
160
<hr />
 
161
<h2>Property Documentation</h2>
 
162
<h3 class="fn"><a name="checkable-prop"></a>checkable : bool</h3>
 
163
<p>This property holds whether the action is a checkable action.</p>
 
164
<p>A checkable action is one which has an on/off state. For example, in a word processor, a Bold toolbar button may be either on or off. An action which is not a toggle action is a command action; a command action is simply executed, e.g. file save. By default, this property is false.</p>
 
165
<p>In some situations, the state of one toggle action should depend on the state of others. For example, &quot;Left Align&quot;, &quot;Center&quot; and &quot;Right Align&quot; 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>
 
166
<p>Access functions:</p>
 
167
<ul>
 
168
<li><div class="fn"/><b>bool isCheckable () const</b></li>
 
169
<li><div class="fn"/><b>void setCheckable ( bool )</b></li>
 
170
</ul>
 
171
<p>See also <a href="qaction.html#checked-prop">QAction::setChecked</a>().</p>
 
172
<h3 class="fn"><a name="checked-prop"></a>checked : bool</h3>
 
173
<p>This property holds whether the action is checked.</p>
 
174
<p>Only checkable actions can be checked. By default, this is false (the action is unchecked).</p>
 
175
<p>Access functions:</p>
 
176
<ul>
 
177
<li><div class="fn"/><b>bool isChecked () const</b></li>
 
178
<li><div class="fn"/><b>void setChecked ( bool )</b></li>
 
179
</ul>
 
180
<p>See also <a href="qaction.html#checkable-prop">checkable</a>.</p>
 
181
<h3 class="fn"><a name="enabled-prop"></a>enabled : bool</h3>
 
182
<p>This property holds whether the action is enabled.</p>
 
183
<p>Disabled actions cannot be chosen by the user. They do not disappear from menus or toolbars, but they are displayed in a way which indicates that they are unavailable. For example, they might be displayed using only shades of gray.</p>
 
184
<p>What's this? help on disabled actions is still available, provided that the <a href="qaction.html#whatsThis-prop">QAction::whatsThis</a> property is set.</p>
 
185
<p>Access functions:</p>
 
186
<ul>
 
187
<li><div class="fn"/><b>bool isEnabled () const</b></li>
 
188
<li><div class="fn"/><b>void setEnabled ( bool )</b></li>
 
189
</ul>
 
190
<h3 class="fn"><a name="font-prop"></a>font : <a href="qfont.html">QFont</a></h3>
 
191
<p>This property holds the action's font.</p>
 
192
<p>The font property is used to render the text set on the <a href="qaction.html">QAction</a>. The font will can be considered a hint as it will not be consulted in all cases based upon application and style.</p>
 
193
<p>Access functions:</p>
 
194
<ul>
 
195
<li><div class="fn"/><b>QFont font () const</b></li>
 
196
<li><div class="fn"/><b>void setFont ( const QFont &amp; <i>font</i> )</b></li>
 
197
</ul>
 
198
<p>See also <a href="qaction.html#text-prop">QAction::setText</a>() and <a href="qstyle.html">QStyle</a>.</p>
 
199
<h3 class="fn"><a name="icon-prop"></a>icon : <a href="qicon.html">QIcon</a></h3>
 
200
<p>This property holds the action's icon.</p>
 
201
<p>In toolbars, the icon is used as the tool button icon; in menus, it is displayed to the left of the menu text. There is no default icon.</p>
 
202
<p>If a null icon (<a href="qicon.html#isNull">QIcon::isNull</a>() is passed into this function, the icon of the action is cleared.</p>
 
203
<p>Access functions:</p>
 
204
<ul>
 
205
<li><div class="fn"/><b>QIcon icon () const</b></li>
 
206
<li><div class="fn"/><b>void setIcon ( const QIcon &amp; <i>icon</i> )</b></li>
 
207
</ul>
 
208
<h3 class="fn"><a name="iconText-prop"></a>iconText : <a href="qstring.html">QString</a></h3>
 
209
<p>This property holds the action's descriptive icon text.</p>
 
210
<p>If QMainWindow::usesTextLabel 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 with <a href="qaction.html#text-prop">setText</a>() or <a href="qaction.html#toolTip-prop">setToolTip</a>(). If the icon text is not explicitly set in the by using setIconText(), the action's normal text will be used as icon text. There is no default icon text.</p>
 
211
<p>Access functions:</p>
 
212
<ul>
 
213
<li><div class="fn"/><b>QString iconText () const</b></li>
 
214
<li><div class="fn"/><b>void setIconText ( const QString &amp; <i>text</i> )</b></li>
 
215
</ul>
 
216
<p>See also <a href="qaction.html#toolTip-prop">setToolTip</a>() and <a href="qaction.html#statusTip-prop">setStatusTip</a>().</p>
 
217
<h3 class="fn"><a name="shortcut-prop"></a>shortcut : <a href="qkeysequence.html">QKeySequence</a></h3>
 
218
<p>This property holds the action's shortcut key.</p>
 
219
<p>Valid keycodes for this property 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 shortcut key.</p>
 
220
<p>Access functions:</p>
 
221
<ul>
 
222
<li><div class="fn"/><b>QKeySequence shortcut () const</b></li>
 
223
<li><div class="fn"/><b>void setShortcut ( const QKeySequence &amp; <i>shortcut</i> )</b></li>
 
224
</ul>
 
225
<h3 class="fn"><a name="shortcutContext-prop"></a>shortcutContext : <a href="qt.html#ShortcutContext-enum">Qt::ShortcutContext</a></h3>
 
226
<p>This property holds the context for the action's shortcut.</p>
 
227
<p>Valid values for this property can be found in <a href="qt.html#ShortcutContext-enum">Qt::ShortcutContext</a>. The default value is <a href="qt.html#ShortcutContext-enum">Qt::WindowShortcut</a>.</p>
 
228
<p>Access functions:</p>
 
229
<ul>
 
230
<li><div class="fn"/><b>Qt::ShortcutContext shortcutContext () const</b></li>
 
231
<li><div class="fn"/><b>void setShortcutContext ( Qt::ShortcutContext <i>context</i> )</b></li>
 
232
</ul>
 
233
<h3 class="fn"><a name="statusTip-prop"></a>statusTip : <a href="qstring.html">QString</a></h3>
 
234
<p>This property holds the action's status tip.</p>
 
235
<p>The statusTip is displayed on all status bars provided by the action's top-level parent widget.</p>
 
236
<p>There is no default statusTip text.</p>
 
237
<p>Access functions:</p>
 
238
<ul>
 
239
<li><div class="fn"/><b>QString statusTip () const</b></li>
 
240
<li><div class="fn"/><b>void setStatusTip ( const QString &amp; <i>statusTip</i> )</b></li>
 
241
</ul>
 
242
<p>See also <a href="qaction.html#toolTip-prop">setToolTip</a>() and <a href="qaction.html#showStatusText">showStatusText</a>().</p>
 
243
<h3 class="fn"><a name="text-prop"></a>text : <a href="qstring.html">QString</a></h3>
 
244
<p>This property holds the action's descriptive text.</p>
 
245
<p>If the action is added to a menu, the menu option will consist of the icon (if there is one), the text, and the shortcut (if there is one). If the text is not explicitly set in the constructor, or by using setText(), the action's description icon text will be used as text. There is no default text.</p>
 
246
<p>Access functions:</p>
 
247
<ul>
 
248
<li><div class="fn"/><b>QString text () const</b></li>
 
249
<li><div class="fn"/><b>void setText ( const QString &amp; <i>text</i> )</b></li>
 
250
</ul>
 
251
<p>See also <a href="qaction.html#iconText-prop">iconText</a>.</p>
 
252
<h3 class="fn"><a name="toolTip-prop"></a>toolTip : <a href="qstring.html">QString</a></h3>
 
253
<p>This property holds the action's tool tip.</p>
 
254
<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>
 
255
<p>If no tool tip is specified the action's text is used.</p>
 
256
<p>Access functions:</p>
 
257
<ul>
 
258
<li><div class="fn"/><b>QString toolTip () const</b></li>
 
259
<li><div class="fn"/><b>void setToolTip ( const QString &amp; <i>tip</i> )</b></li>
 
260
</ul>
 
261
<p>See also <a href="qaction.html#statusTip-prop">setStatusTip</a>() and <a href="qaction.html#shortcut-prop">setShortcut</a>().</p>
 
262
<h3 class="fn"><a name="visible-prop"></a>visible : bool</h3>
 
263
<p>This property holds whether the action can be seen (e.g. in menus and toolbars).</p>
 
264
<p>If <i>visible</i> is true the action can be seen (e.g. in menus and toolbars) and chosen by the user; if <i>visible</i> is false the action cannot be seen or chosen by the user.</p>
 
265
<p>Actions which are not visible are <i>not</i> grayed out; they do not appear at all.</p>
 
266
<p>Access functions:</p>
 
267
<ul>
 
268
<li><div class="fn"/><b>bool isVisible () const</b></li>
 
269
<li><div class="fn"/><b>void setVisible ( bool )</b></li>
 
270
</ul>
 
271
<h3 class="fn"><a name="whatsThis-prop"></a>whatsThis : <a href="qstring.html">QString</a></h3>
 
272
<p>This property holds the action's "What's This?" help text.</p>
 
273
<p>The &quot;What's This?&quot; text is used to provide a brief description of the action. The text may contain rich text. There is no default &quot;What's This?&quot; text.</p>
 
274
<p>Access functions:</p>
 
275
<ul>
 
276
<li><div class="fn"/><b>QString whatsThis () const</b></li>
 
277
<li><div class="fn"/><b>void setWhatsThis ( const QString &amp; <i>what</i> )</b></li>
 
278
</ul>
 
279
<p>See also <a href="qwhatsthis.html">QWhatsThis</a> and <a href="porting4.html#qstylesheet">QStyleSheet</a>.</p>
 
280
<hr />
 
281
<h2>Member Function Documentation</h2>
 
282
<h3 class="fn"><a name="QAction"></a>QAction::QAction ( <a href="qobject.html">QObject</a> * <i>parent</i> )</h3>
 
283
<p>Constructs an action with <i>parent</i>. If <i>parent</i> is an action group the action will be automatically inserted into the group.</p>
 
284
<h3 class="fn"><a name="QAction-2"></a>QAction::QAction ( const <a href="qstring.html">QString</a> &amp; <i>text</i>, <a href="qobject.html">QObject</a> * <i>parent</i> )</h3>
 
285
<p>Constructs an action with some <i>text</i> and <i>parent</i>. If <i>parent</i> is an action group the action will be automatically inserted into the group.</p>
 
286
<p>The action uses a stripped version of <i>text</i> (e.g. &quot;&amp;Menu Option...&quot; becomes &quot;Menu Option&quot;) as descriptive text for toolbuttons. You can override this by setting a specific description with <a href="qaction.html#text-prop">setText</a>(). The same text will be used for tool tips unless you specify a different test using <a href="qaction.html#toolTip-prop">setToolTip</a>().</p>
 
287
<h3 class="fn"><a name="QAction-3"></a>QAction::QAction ( const <a href="qicon.html">QIcon</a> &amp; <i>icon</i>, const <a href="qstring.html">QString</a> &amp; <i>text</i>, <a href="qobject.html">QObject</a> * <i>parent</i> )</h3>
 
288
<p>Constructs an action with an <i>icon</i> and some <i>text</i> and <i>parent</i>. If <i>parent</i> is an action group the action will be automatically inserted into the group.</p>
 
289
<p>The action uses a stripped version of <i>text</i> (e.g. &quot;&amp;Menu Option...&quot; becomes &quot;Menu Option&quot;) as descriptive text for toolbuttons. You can override this by setting a specific description with <a href="qaction.html#text-prop">setText</a>(). The same text will be used for tool tips unless you specify a different test using <a href="qaction.html#toolTip-prop">setToolTip</a>().</p>
 
290
<h3 class="fn"><a name="dtor.QAction"></a>QAction::~QAction ()</h3>
 
291
<p>Destroys the object and frees allocated resources.</p>
 
292
<h3 class="fn"><a name="actionGroup"></a><a href="qactiongroup.html">QActionGroup</a> * QAction::actionGroup () const</h3>
 
293
<p>Returns the action group for this action. If no action group manages this action then 0 will be returned.</p>
 
294
<p>See also <a href="qactiongroup.html">QActionGroup</a> and <a href="qaction.html#setActionGroup">QAction::setActionGroup</a>().</p>
 
295
<h3 class="fn"><a name="activate"></a>void QAction::activate ( <a href="qaction.html#ActionEvent-enum">ActionEvent</a> <i>event</i> )</h3>
 
296
<p>Sends the relevant signals for <a href="qaction.html#ActionEvent-enum">ActionEvent</a> <i>event</i>.</p>
 
297
<p>Action based widgets use this API to cause the <a href="qaction.html">QAction</a> to emit signals as well as emitting their own.</p>
 
298
<h3 class="fn"><a name="changed"></a>void QAction::changed ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
299
<p>This signal is emitted when an action has changed. If you are only interested in actions in a given widget, you can watch for <a href="qwidget.html#actionEvent">QWidget::actionEvent</a>() sent with an <a href="qevent.html#Type-enum">QEvent::ActionChanged</a>.</p>
 
300
<p>See also <a href="qwidget.html#actionEvent">QWidget::actionEvent</a>().</p>
 
301
<h3 class="fn"><a name="data"></a><a href="qvariant.html">QVariant</a> QAction::data () const</h3>
 
302
<p>Returns the user data as set in QAction::setData.</p>
 
303
<p>See also <a href="qaction.html#setData">setData</a>().</p>
 
304
<h3 class="fn"><a name="hover"></a>void QAction::hover ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
305
<p>This is a convenience slot that calls activate(Hover).</p>
 
306
<h3 class="fn"><a name="hovered"></a>void QAction::hovered ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
307
<p>This signal is emitted when an action is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.</p>
 
308
<p>See also <a href="qaction.html#activate">QAction::activate</a>().</p>
 
309
<h3 class="fn"><a name="isSeparator"></a>bool QAction::isSeparator () const</h3>
 
310
<p>Returns true if this action is a separator action; otherwise it returns false.</p>
 
311
<p>See also <a href="qaction.html#setSeparator">QAction::setSeparator</a>().</p>
 
312
<h3 class="fn"><a name="menu"></a><a href="qmenu.html">QMenu</a> * QAction::menu () const</h3>
 
313
<p>Returns the menu contained by this action. Actions that contain menus can be used to create menu items with submenus, or inserted into toolbars to create buttons with popup menus.</p>
 
314
<p>See also <a href="qmenu.html#addAction">QMenu::addAction</a>().</p>
 
315
<h3 class="fn"><a name="parentWidget"></a><a href="qwidget.html">QWidget</a> * QAction::parentWidget () const</h3>
 
316
<p>Returns the parent widget.</p>
 
317
<h3 class="fn"><a name="setActionGroup"></a>void QAction::setActionGroup ( <a href="qactiongroup.html">QActionGroup</a> * <i>group</i> )</h3>
 
318
<p>Sets this action group to <i>group</i>. The action will be automatically added to the group's list of actions.</p>
 
319
<p>Actions within the group will be mutually exclusive.</p>
 
320
<p>See also <a href="qactiongroup.html">QActionGroup</a> and <a href="qaction.html#actionGroup">QAction::actionGroup</a>().</p>
 
321
<h3 class="fn"><a name="setData"></a>void QAction::setData ( const <a href="qvariant.html">QVariant</a> &amp; <i>data</i> )</h3>
 
322
<p>Sets internal data to <i>data</i>. This can be used for user data to store anything that a <a href="qvariant.html">QVariant</a> can store. The ownership of anything the the user data will remain with the variant and thus be referenced counted as appropriate.</p>
 
323
<p>See also <a href="qaction.html#data">data</a>().</p>
 
324
<h3 class="fn"><a name="setDisabled"></a>void QAction::setDisabled ( bool <i>b</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
325
<p>This is a convenience function for the <a href="qaction.html#enabled-prop">enabled</a> property, that is useful for signals--slots connections. If <i>b</i> is true the action is disabled; otherwise it is enabled.</p>
 
326
<h3 class="fn"><a name="setMenu"></a>void QAction::setMenu ( <a href="qmenu.html">QMenu</a> * <i>menu</i> )</h3>
 
327
<p>Sets the menu contained by this action.</p>
 
328
<h3 class="fn"><a name="setSeparator"></a>void QAction::setSeparator ( bool <i>b</i> )</h3>
 
329
<p>If <i>b</i> is true then this action will be considered a separator.</p>
 
330
<p>How a separator is represented depends on the widget it is inserted into. Under most circumstances the text, submenu, and icon will be ignored for separator actions.</p>
 
331
<p>See also <a href="qaction.html#isSeparator">QAction::isSeparator</a>().</p>
 
332
<h3 class="fn"><a name="showStatusText"></a>bool QAction::showStatusText ( <a href="qwidget.html">QWidget</a> * <i>widget</i> = 0 )</h3>
 
333
<p>Updates the status bar for <i>widget</i>. If widget is an appropriate <a href="qstatusbar.html">QStatusBar</a> found for for this action based on the parent heirarchy will be used.</p>
 
334
<p>See also <a href="qaction.html#statusTip-prop">statusTip</a>.</p>
 
335
<h3 class="fn"><a name="toggle"></a>void QAction::toggle ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
336
<p>This is a convenience function for the <a href="qaction.html#checked-prop">checked</a> property. Connect to it to change the checked state to its opposite state.</p>
 
337
<h3 class="fn"><a name="toggled"></a>void QAction::toggled ( bool <i>checked</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
338
<p>This signal is emitted whenever a checkable action changes its <a href="qaction.html#checked-prop">isChecked</a>() status. This can be the result of a user interaction, or because <a href="qaction.html#checked-prop">setChecked</a>() was called.</p>
 
339
<p><i>checked</i> is true if the action is checked, or false if the action is unchecked.</p>
 
340
<p>See also <a href="qaction.html#activate">QAction::activate</a>(), <a href="qaction.html#triggered">QAction::triggered</a>(), and <a href="qaction.html#checked-prop">checked</a>.</p>
 
341
<h3 class="fn"><a name="trigger"></a>void QAction::trigger ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
342
<p>This is a convenience slot that calls activate(Trigger).</p>
 
343
<h3 class="fn"><a name="triggered"></a>void QAction::triggered ( bool <i>checked</i> = false )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
344
<p>This signal is emitted when an action is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination, or when <a href="qaction.html#trigger">trigger</a>() was called. Notably, it is <i>not</i> emitted when <a href="qaction.html#checked-prop">setChecked</a>() or <a href="qaction.html#toggle">toggle</a>() is called.</p>
 
345
<p>If the action is checkable, <i>checked</i> is true if the action is checked, or false if the action is unchecked.</p>
 
346
<p>See also <a href="qaction.html#activate">QAction::activate</a>(), <a href="qaction.html#toggled">QAction::toggled</a>(), and <a href="qaction.html#checked-prop">checked</a>.</p>
 
347
<p /><address><hr /><div align="center">
 
348
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
349
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
350
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
351
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
352
</tr></table></div></address></body>
 
353
</html>