File: qmenubar.html

package info (click to toggle)
qt4-x11 4%3A4.8.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 701,696 kB
  • sloc: cpp: 2,686,179; ansic: 375,485; python: 25,859; sh: 19,349; xml: 17,091; perl: 14,765; yacc: 5,383; asm: 5,038; makefile: 1,259; lex: 555; ruby: 526; objc: 347; cs: 112; pascal: 112; php: 54; sed: 34
file content (458 lines) | stat: -rw-r--r-- 46,744 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qmenubar.cpp -->
  <title>Qt 4.8: QMenuBar Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QMenuBar</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#usage">Usage</a></li>
<li class="level2"><a href="#platform-dependent-look-and-feel">Platform Dependent Look and Feel</a></li>
<li class="level2"><a href="#qmenubar-on-mac-os-x">QMenuBar on Mac OS X</a></li>
<li class="level2"><a href="#qmenubar-on-windows-ce">QMenuBar on Windows CE</a></li>
<li class="level2"><a href="#examples">Examples</a></li>
</ul>
</div>
<h1 class="title">QMenuBar Class Reference</h1>
<!-- $$$QMenuBar-brief -->
<p>The QMenuBar class provides a horizontal menu bar. <a href="#details">More...</a></p>
<!-- @@@QMenuBar -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QMenuBar&gt;</span></pre><p><b>Inherits: </b><a href="qwidget.html">QWidget</a>.</p>
<ul>
<li><a href="qmenubar-members.html">List of all members, including inherited members</a></li>
<li><a href="qmenubar-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><a href="qmenubar.html#defaultUp-prop">defaultUp</a></b> : bool</li>
<li class="fn"><b><a href="qmenubar.html#nativeMenuBar-prop">nativeMenuBar</a></b> : bool</li>
</ul>
<ul>
<li class="fn">58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#QMenuBar">QMenuBar</a></b> ( QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#dtor.QMenuBar">~QMenuBar</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#actionAt">actionAt</a></b> ( const QPoint &amp; <i>pt</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#actionGeometry">actionGeometry</a></b> ( QAction * <i>act</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#activeAction">activeAction</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addAction">addAction</a></b> ( const QString &amp; <i>text</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addAction-2">addAction</a></b> ( const QString &amp; <i>text</i>, const QObject * <i>receiver</i>, const char * <i>member</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addAction-3">addAction</a></b> ( QAction * <i>action</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addMenu">addMenu</a></b> ( QMenu * <i>menu</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMenu * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addMenu-2">addMenu</a></b> ( const QString &amp; <i>title</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMenu * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addMenu-3">addMenu</a></b> ( const QIcon &amp; <i>icon</i>, const QString &amp; <i>title</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addSeparator">addSeparator</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#cornerWidget">cornerWidget</a></b> ( Qt::Corner <i>corner</i> = Qt::TopRightCorner ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#defaultAction">defaultAction</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#insertMenu">insertMenu</a></b> ( QAction * <i>before</i>, QMenu * <i>menu</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction * </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#insertSeparator">insertSeparator</a></b> ( QAction * <i>before</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#defaultUp-prop">isDefaultUp</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#nativeMenuBar-prop">isNativeMenuBar</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#setActiveAction">setActiveAction</a></b> ( QAction * <i>act</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#setCornerWidget">setCornerWidget</a></b> ( QWidget * <i>widget</i>, Qt::Corner <i>corner</i> = Qt::TopRightCorner )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#setDefaultAction">setDefaultAction</a></b> ( QAction * <i>act</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#defaultUp-prop">setDefaultUp</a></b> ( bool )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#nativeMenuBar-prop">setNativeMenuBar</a></b> ( bool <i>nativeMenuBar</i> )</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#heightForWidth">heightForWidth</a></b> ( int ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#minimumSizeHint">minimumSizeHint</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#sizeHint">sizeHint</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">221 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li class="fn">13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#setVisible">setVisible</a></b> ( bool <i>visible</i> )</td></tr>
</table>
<ul>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#hovered">hovered</a></b> ( QAction * <i>action</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#triggered">triggered</a></b> ( QAction * <i>action</i> )</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#initStyleOption">initStyleOption</a></b> ( QStyleOptionMenuItem * <i>option</i>, const QAction * <i>action</i> ) const</td></tr>
</table>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#actionEvent">actionEvent</a></b> ( QActionEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#changeEvent">changeEvent</a></b> ( QEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#event">event</a></b> ( QEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#eventFilter">eventFilter</a></b> ( QObject * <i>object</i>, QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#focusInEvent">focusInEvent</a></b> ( QFocusEvent * )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#focusOutEvent">focusOutEvent</a></b> ( QFocusEvent * )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#keyPressEvent">keyPressEvent</a></b> ( QKeyEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#leaveEvent">leaveEvent</a></b> ( QEvent * )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#mouseMoveEvent">mouseMoveEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#mousePressEvent">mousePressEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#mouseReleaseEvent">mouseReleaseEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#paintEvent">paintEvent</a></b> ( QPaintEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#resizeEvent">resizeEvent</a></b> ( QResizeEvent * )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#timerEvent">timerEvent</a></b> ( QTimerEvent * <i>e</i> )</td></tr>
</table>
<ul>
<li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<!-- $$$QMenuBar-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QMenuBar class provides a horizontal menu bar.</p>
<p>A menu bar consists of a list of pull-down menu items. You add menu items with <a href="qmenubar.html#addMenu">addMenu</a>(). For example, asuming that <tt>menubar</tt> is a pointer to a QMenuBar and <tt>fileMenu</tt> is a pointer to a <a href="qmenu.html">QMenu</a>, the following statement inserts the menu into the menu bar:</p>
<pre class="cpp"> menubar<span class="operator">-</span><span class="operator">&gt;</span><a href="qmenubar.html#addMenu">addMenu</a>(fileMenu);</pre>
<p>The ampersand in the menu item's text sets Alt+F as a shortcut for this menu. (You can use &quot;&amp;&amp;&quot; to get a real ampersand in the menu bar.)</p>
<p>There is no need to lay out a menu bar. It automatically sets its own geometry to the top of the parent widget and changes it appropriately whenever the parent is resized.</p>
<a name="usage"></a>
<h3>Usage</h3>
<p>In most main window style applications you would use the <a href="qmainwindow.html#menuBar">menuBar()</a> function provided in <a href="qmainwindow.html">QMainWindow</a>, adding <a href="qmenu.html">QMenu</a>s to the menu bar and adding <a href="qaction.html">QAction</a>s to the pop-up menus.</p>
<p>Example (from the <a href="mainwindows-menus.html">Menus</a> example):</p>
<pre class="cpp">     fileMenu <span class="operator">=</span> menuBar()<span class="operator">-</span><span class="operator">&gt;</span>addMenu(tr(<span class="string">&quot;&amp;File&quot;</span>));
     fileMenu<span class="operator">-</span><span class="operator">&gt;</span>addAction(newAct);</pre>
<p>Menu items may be removed with <a href="qwidget.html#removeAction">removeAction</a>().</p>
<p>Widgets can be added to menus by using instances of the <a href="qwidgetaction.html">QWidgetAction</a> class to hold them. These actions can then be inserted into menus in the usual way; see the <a href="qmenu.html">QMenu</a> documentation for more details.</p>
<a name="platform-dependent-look-and-feel"></a>
<h3>Platform Dependent Look and Feel</h3>
<p>Different platforms have different requirements for the appearance of menu bars and their behavior when the user interacts with them. For example, Windows systems are often configured so that the underlined character mnemonics that indicate keyboard shortcuts for items in the menu bar are only shown when the <b>Alt</b> key is pressed.</p>
<table class="generic">
<tr valign="top" class="odd"><td ><img src="images/plastique-menubar.png" alt="A menu bar shown in the" /> Plastique widget style.</td><td >The <a href="qplastiquestyle.html">Plastique widget style</a>, like most other styles, handles the <b>Help</b> menu in the same way as it handles any other menu.</td></tr>
<tr valign="top" class="even"><td ><img src="images/motif-menubar.png" alt="A menu bar shown in the" /> Motif widget style.</td><td >The <a href="qmotifstyle.html">Motif widget style</a> treats <b>Help</b> menus in a special way, placing them at right-hand end of the menu bar.</td></tr>
</table>
<a name="qmenubar-on-mac-os-x"></a>
<h3>QMenuBar on Mac OS X</h3>
<p>QMenuBar on Mac OS X is a wrapper for using the system-wide menu bar. If you have multiple menu bars in one dialog the outermost menu bar (normally inside a widget with widget flag <a href="qt.html#WindowType-enum">Qt::Window</a>) will be used for the system-wide menu bar.</p>
<p>Qt for Mac OS X also provides a menu bar merging feature to make QMenuBar conform more closely to accepted Mac OS X menu bar layout. The merging functionality is based on string matching the title of a <a href="qmenu.html">QMenu</a> entry. These strings are translated (using <a href="qobject.html#tr">QObject::tr</a>()) in the &quot;QMenuBar&quot; context. If an entry is moved its slots will still fire as if it was in the original place. The table below outlines the strings looked for and where the entry is placed if matched:</p>
<table class="generic">
<thead><tr class="qt-style"><th >String matches</th><th >Placement</th><th >Notes</th></tr></thead>
<tr valign="top" class="odd"><td >about.*</td><td >Application Menu | About &lt;application name&gt;</td><td >The application name is fetched from the <tt>Info.plist</tt> file (see note below). If this entry is not found no About item will appear in the Application Menu.</td></tr>
<tr valign="top" class="even"><td >config, options, setup, settings or preferences</td><td >Application Menu | Preferences</td><td >If this entry is not found the Settings item will be disabled</td></tr>
<tr valign="top" class="odd"><td >quit or exit</td><td >Application Menu | Quit &lt;application name&gt;</td><td >If this entry is not found a default Quit item will be created to call <a href="qcoreapplication.html#quit">QApplication::quit</a>()</td></tr>
</table>
<p>You can override this behavior by using the <a href="qaction.html#menuRole-prop">QAction::menuRole</a>() property.</p>
<p>If you want all windows in a Mac application to share one menu bar, you must create a menu bar that does not have a parent. Create a parent-less menu bar this way:</p>
<pre class="cpp"> <span class="type">QMenuBar</span> <span class="operator">*</span>menuBar <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QMenuBar</span>(<span class="number">0</span>);</pre>
<p><b>Note:</b> Do <i>not</i> call <a href="qmainwindow.html#menuBar">QMainWindow::menuBar</a>() to create the shared menu bar, because that menu bar will have the <a href="qmainwindow.html">QMainWindow</a> as its parent. That menu bar would only be displayed for the parent <a href="qmainwindow.html">QMainWindow</a>.</p>
<p><b>Note:</b> The text used for the application name in the menu bar is obtained from the value set in the <tt>Info.plist</tt> file in the application's bundle. See <a href="deployment-mac.html">Deploying an Application on Mac OS X</a> for more information.</p>
<a name="qmenubar-on-windows-ce"></a>
<h3>QMenuBar on Windows CE</h3>
<p>QMenuBar on Windows CE is a wrapper for using the system-wide menu bar, similar to the Mac. This feature is activated for Windows Mobile and integrates QMenuBar with the native soft keys. The left soft key can be controlled with <a href="qmenubar.html#setDefaultAction">QMenuBar::setDefaultAction</a>() and the right soft key can be used to access the menu bar.</p>
<p>The <a href="qmenubar.html#hovered">hovered</a>() signal is not supported for the native menu integration. Also, it is not possible to display an icon in a native menu on Windows Mobile.</p>
<a name="examples"></a>
<h3>Examples</h3>
<p>The <a href="mainwindows-menus.html">Menus</a> example shows how to use QMenuBar and <a href="qmenu.html">QMenu</a>. The other <a href="examples-mainwindow.html">main window application examples</a> also provide menus using these classes.</p>
</div>
<p><b>See also </b><a href="qmenu.html">QMenu</a>, <a href="qshortcut.html">QShortcut</a>, <a href="qaction.html">QAction</a>, <a href="http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/XHIGIntro.html">Introduction to Apple Human Interface Guidelines</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Menu Bar</a>, and <a href="mainwindows-menus.html">Menus Example</a>.</p>
<!-- @@@QMenuBar -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$defaultUp-prop$$$isDefaultUp$$$setDefaultUpbool -->
<h3 class="fn"><a name="defaultUp-prop"></a><span class="name">defaultUp</span> : <span class="type">bool</span></h3>
<p>This property holds the popup orientation.</p>
<p>The default popup orientation. By default, menus pop &quot;down&quot; the screen. By setting the property to true, the menu will pop &quot;up&quot;. You might call this for menus that are <i>below</i> the document to which they refer.</p>
<p>If the menu would not fit on the screen, the other direction is used automatically.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isDefaultUp</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDefaultUp</b></span> ( bool )</td></tr>
</table>
<!-- @@@defaultUp -->
<!-- $$$nativeMenuBar-prop$$$isNativeMenuBar$$$setNativeMenuBarbool -->
<h3 class="fn"><a name="nativeMenuBar-prop"></a><span class="name">nativeMenuBar</span> : <span class="type">bool</span></h3>
<p>This property holds whether or not a menubar will be used as a native menubar on platforms that support it.</p>
<p>This property specifies whether or not the menubar should be used as a native menubar on platforms that support it. The currently supported platforms are Mac OS X and Windows CE. On these platforms if this property is true, the menubar is used in the native menubar and is not in the window of its parent, if false the menubar remains in the window. On other platforms the value of this attribute has no effect.</p>
<p>The default is to follow whether the <a href="qt.html#ApplicationAttribute-enum">Qt::AA_DontUseNativeMenuBar</a> attribute is set for the application. Explicitly settings this property overrides the presence (or abscence) of the attribute.</p>
<p>This property was introduced in Qt 4.6.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isNativeMenuBar</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setNativeMenuBar</b></span> ( bool <i>nativeMenuBar</i> )</td></tr>
</table>
<p><b>See also </b><a href="exportedfunctions.html#void-qt-mac-set-native-menubar-bool-enable">void-qt-mac-set-native-menubar-bool-enable</a>.</p>
<!-- @@@nativeMenuBar -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QMenuBar[overload1]$$$QMenuBarQWidget* -->
<h3 class="fn"><a name="QMenuBar"></a>QMenuBar::<span class="name">QMenuBar</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a menu bar with parent <i>parent</i>.</p>
<!-- @@@QMenuBar -->
<!-- $$$~QMenuBar[overload1]$$$~QMenuBar -->
<h3 class="fn"><a name="dtor.QMenuBar"></a>QMenuBar::<span class="name">~QMenuBar</span> ()</h3>
<p>Destroys the menu bar.</p>
<!-- @@@~QMenuBar -->
<!-- $$$actionAt[overload1]$$$actionAtconstQPoint& -->
<h3 class="fn"><a name="actionAt"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">actionAt</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp; <i>pt</i> ) const</h3>
<p>Returns the <a href="qaction.html">QAction</a> at <i>pt</i>. Returns 0 if there is no action at <i>pt</i> or if the location has a separator.</p>
<p><b>See also </b><a href="qmenubar.html#addAction">addAction</a>() and <a href="qmenubar.html#addSeparator">addSeparator</a>().</p>
<!-- @@@actionAt -->
<!-- $$$actionEvent[overload1]$$$actionEventQActionEvent* -->
<h3 class="fn"><a name="actionEvent"></a><span class="type">void</span> QMenuBar::<span class="name">actionEvent</span> ( <span class="type"><a href="qactionevent.html">QActionEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#actionEvent">QWidget::actionEvent</a>().</p>
<!-- @@@actionEvent -->
<!-- $$$actionGeometry[overload1]$$$actionGeometryQAction* -->
<h3 class="fn"><a name="actionGeometry"></a><span class="type"><a href="qrect.html">QRect</a></span> QMenuBar::<span class="name">actionGeometry</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>act</i> ) const</h3>
<p>Returns the geometry of action <i>act</i> as a <a href="qrect.html">QRect</a>.</p>
<p><b>See also </b><a href="qmenubar.html#actionAt">actionAt</a>().</p>
<!-- @@@actionGeometry -->
<!-- $$$activeAction[overload1]$$$activeAction -->
<h3 class="fn"><a name="activeAction"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">activeAction</span> () const</h3>
<p>Returns the <a href="qaction.html">QAction</a> that is currently highlighted. A null pointer will be returned if no action is currently selected.</p>
<p><b>See also </b><a href="qmenubar.html#setActiveAction">setActiveAction</a>().</p>
<!-- @@@activeAction -->
<!-- $$$addAction[overload1]$$$addActionconstQString& -->
<h3 class="fn"><a name="addAction"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">addAction</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i> )</h3>
<p>This is an overloaded function.</p>
<p>This convenience function creates a new action with <i>text</i>. The function adds the newly created action to the menu's list of actions, and returns it.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qwidget.html#actions">QWidget::actions</a>().</p>
<!-- @@@addAction -->
<!-- $$$addAction$$$addActionconstQString&constQObject*constchar* -->
<h3 class="fn"><a name="addAction-2"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">addAction</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i>, const <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, const <span class="type">char</span> * <i>member</i> )</h3>
<p>This is an overloaded function.</p>
<p>This convenience function creates a new action with the given <i>text</i>. The action's <a href="qmenubar.html#triggered">triggered</a>() signal is connected to the <i>receiver</i>'s <i>member</i> slot. The function adds the newly created action to the menu's list of actions and returns it.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qwidget.html#actions">QWidget::actions</a>().</p>
<!-- @@@addAction -->
<!-- $$$addAction$$$addActionQAction* -->
<h3 class="fn"><a name="addAction-3"></a><span class="type">void</span> QMenuBar::<span class="name">addAction</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>action</i> )</h3>
<p>This is an overloaded function.</p>
<p>Appends the action <i>action</i> to the menu bar's list of actions.</p>
<p><b>See also </b><a href="qmenu.html#addAction">QMenu::addAction</a>(), <a href="qwidget.html#addAction">QWidget::addAction</a>(), and <a href="qwidget.html#actions">QWidget::actions</a>().</p>
<!-- @@@addAction -->
<!-- $$$addMenu[overload1]$$$addMenuQMenu* -->
<h3 class="fn"><a name="addMenu"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">addMenu</span> ( <span class="type"><a href="qmenu.html">QMenu</a></span> * <i>menu</i> )</h3>
<p>Appends <i>menu</i> to the menu bar. Returns the menu's menuAction().</p>
<p><b>Note:</b> The returned <a href="qaction.html">QAction</a> object can be used to hide the corresponding menu.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qmenu.html#menuAction">QMenu::menuAction</a>().</p>
<!-- @@@addMenu -->
<!-- $$$addMenu$$$addMenuconstQString& -->
<h3 class="fn"><a name="addMenu-2"></a><span class="type"><a href="qmenu.html">QMenu</a></span> * QMenuBar::<span class="name">addMenu</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>title</i> )</h3>
<p>Appends a new <a href="qmenu.html">QMenu</a> with <i>title</i> to the menu bar. The menu bar takes ownership of the menu. Returns the new menu.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qmenu.html#menuAction">QMenu::menuAction</a>().</p>
<!-- @@@addMenu -->
<!-- $$$addMenu$$$addMenuconstQIcon&constQString& -->
<h3 class="fn"><a name="addMenu-3"></a><span class="type"><a href="qmenu.html">QMenu</a></span> * QMenuBar::<span class="name">addMenu</span> ( const <span class="type"><a href="qicon.html">QIcon</a></span> &amp; <i>icon</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>title</i> )</h3>
<p>Appends a new <a href="qmenu.html">QMenu</a> with <i>icon</i> and <i>title</i> to the menu bar. The menu bar takes ownership of the menu. Returns the new menu.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qmenu.html#menuAction">QMenu::menuAction</a>().</p>
<!-- @@@addMenu -->
<!-- $$$addSeparator[overload1]$$$addSeparator -->
<h3 class="fn"><a name="addSeparator"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">addSeparator</span> ()</h3>
<p>Appends a separator to the menu.</p>
<!-- @@@addSeparator -->
<!-- $$$changeEvent[overload1]$$$changeEventQEvent* -->
<h3 class="fn"><a name="changeEvent"></a><span class="type">void</span> QMenuBar::<span class="name">changeEvent</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget::changeEvent</a>().</p>
<!-- @@@changeEvent -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QMenuBar::<span class="name">clear</span> ()</h3>
<p>Removes all the actions from the menu bar.</p>
<p><b>Note:</b> On Mac OS X, menu items that have been merged to the system menu bar are not removed by this function. One way to handle this would be to remove the extra actions yourself. You can set the <a href="qaction.html#MenuRole-enum">menu role</a> on the different menus, so that you know ahead of time which menu items get merged and which do not. Then decide what to recreate or remove yourself.</p>
<p><b>See also </b><a href="qwidget.html#removeAction">removeAction</a>().</p>
<!-- @@@clear -->
<!-- $$$cornerWidget[overload1]$$$cornerWidgetQt::Corner -->
<h3 class="fn"><a name="cornerWidget"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QMenuBar::<span class="name">cornerWidget</span> ( <span class="type"><a href="qt.html#Corner-enum">Qt::Corner</a></span> <i>corner</i> = Qt::TopRightCorner ) const</h3>
<p>Returns the widget on the left of the first or on the right of the last menu item, depending on <i>corner</i>.</p>
<p><b>Note:</b> Using a corner other than <a href="qt.html#Corner-enum">Qt::TopRightCorner</a> or <a href="qt.html#Corner-enum">Qt::TopLeftCorner</a> will result in a warning.</p>
<p><b>See also </b><a href="qmenubar.html#setCornerWidget">setCornerWidget</a>().</p>
<!-- @@@cornerWidget -->
<!-- $$$defaultAction[overload1]$$$defaultAction -->
<h3 class="fn"><a name="defaultAction"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">defaultAction</span> () const</h3>
<p>Returns the current default action.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qmenubar.html#setDefaultAction">setDefaultAction</a>().</p>
<!-- @@@defaultAction -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QMenuBar::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$eventFilter[overload1]$$$eventFilterQObject*QEvent* -->
<h3 class="fn"><a name="eventFilter"></a><span class="type">bool</span> QMenuBar::<span class="name">eventFilter</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>object</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#eventFilter">QObject::eventFilter</a>().</p>
<!-- @@@eventFilter -->
<!-- $$$focusInEvent[overload1]$$$focusInEventQFocusEvent* -->
<h3 class="fn"><a name="focusInEvent"></a><span class="type">void</span> QMenuBar::<span class="name">focusInEvent</span> ( <span class="type"><a href="qfocusevent.html">QFocusEvent</a></span> * )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget::focusInEvent</a>().</p>
<!-- @@@focusInEvent -->
<!-- $$$focusOutEvent[overload1]$$$focusOutEventQFocusEvent* -->
<h3 class="fn"><a name="focusOutEvent"></a><span class="type">void</span> QMenuBar::<span class="name">focusOutEvent</span> ( <span class="type"><a href="qfocusevent.html">QFocusEvent</a></span> * )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget::focusOutEvent</a>().</p>
<!-- @@@focusOutEvent -->
<!-- $$$heightForWidth[overload1]$$$heightForWidthint -->
<h3 class="fn"><a name="heightForWidth"></a><span class="type">int</span> QMenuBar::<span class="name">heightForWidth</span> ( <span class="type">int</span> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget::heightForWidth</a>().</p>
<!-- @@@heightForWidth -->
<!-- $$$hovered[overload1]$$$hoveredQAction* -->
<h3 class="fn"><a name="hovered"></a><span class="type">void</span> QMenuBar::<span class="name">hovered</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>action</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when a menu action is highlighted; <i>action</i> is the action that caused the event to be sent.</p>
<p>Often this is used to update status information.</p>
<p><b>See also </b><a href="qmenubar.html#triggered">triggered</a>() and <a href="qaction.html#hovered">QAction::hovered</a>().</p>
<!-- @@@hovered -->
<!-- $$$initStyleOption[overload1]$$$initStyleOptionQStyleOptionMenuItem*constQAction* -->
<h3 class="fn"><a name="initStyleOption"></a><span class="type">void</span> QMenuBar::<span class="name">initStyleOption</span> ( <span class="type"><a href="qstyleoptionmenuitem.html">QStyleOptionMenuItem</a></span> * <i>option</i>, const <span class="type"><a href="qaction.html">QAction</a></span> * <i>action</i> ) const<tt> [protected]</tt></h3>
<p>Initialize <i>option</i> with the values from the menu bar and information from <i>action</i>. This method is useful for subclasses when they need a <a href="qstyleoptionmenuitem.html">QStyleOptionMenuItem</a>, but don't want to fill in all the information themselves.</p>
<p><b>See also </b><a href="qstyleoption.html#initFrom">QStyleOption::initFrom</a>() and <a href="qmenu.html#initStyleOption">QMenu::initStyleOption</a>().</p>
<!-- @@@initStyleOption -->
<!-- $$$insertMenu[overload1]$$$insertMenuQAction*QMenu* -->
<h3 class="fn"><a name="insertMenu"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">insertMenu</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>before</i>, <span class="type"><a href="qmenu.html">QMenu</a></span> * <i>menu</i> )</h3>
<p>This convenience function inserts <i>menu</i> before action <i>before</i> and returns the menus menuAction().</p>
<p><b>See also </b><a href="qwidget.html#insertAction">QWidget::insertAction</a>() and <a href="qmenubar.html#addMenu">addMenu</a>().</p>
<!-- @@@insertMenu -->
<!-- $$$insertSeparator[overload1]$$$insertSeparatorQAction* -->
<h3 class="fn"><a name="insertSeparator"></a><span class="type"><a href="qaction.html">QAction</a></span> * QMenuBar::<span class="name">insertSeparator</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>before</i> )</h3>
<p>This convenience function creates a new separator action, i.e&#x2e; an action with <a href="qaction.html#isSeparator">QAction::isSeparator</a>() returning true. The function inserts the newly created action into this menu bar's list of actions before action <i>before</i> and returns it.</p>
<p><b>See also </b><a href="qwidget.html#insertAction">QWidget::insertAction</a>() and <a href="qmenubar.html#addSeparator">addSeparator</a>().</p>
<!-- @@@insertSeparator -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn"><a name="keyPressEvent"></a><span class="type">void</span> QMenuBar::<span class="name">keyPressEvent</span> ( <span class="type"><a href="qkeyevent.html">QKeyEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>().</p>
<!-- @@@keyPressEvent -->
<!-- $$$leaveEvent[overload1]$$$leaveEventQEvent* -->
<h3 class="fn"><a name="leaveEvent"></a><span class="type">void</span> QMenuBar::<span class="name">leaveEvent</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#leaveEvent">QWidget::leaveEvent</a>().</p>
<!-- @@@leaveEvent -->
<!-- $$$minimumSizeHint[overload1]$$$minimumSizeHint -->
<h3 class="fn"><a name="minimumSizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QMenuBar::<span class="name">minimumSizeHint</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget::minimumSizeHint</a>().</p>
<!-- @@@minimumSizeHint -->
<!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQMouseEvent* -->
<h3 class="fn"><a name="mouseMoveEvent"></a><span class="type">void</span> QMenuBar::<span class="name">mouseMoveEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>().</p>
<!-- @@@mouseMoveEvent -->
<!-- $$$mousePressEvent[overload1]$$$mousePressEventQMouseEvent* -->
<h3 class="fn"><a name="mousePressEvent"></a><span class="type">void</span> QMenuBar::<span class="name">mousePressEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>().</p>
<!-- @@@mousePressEvent -->
<!-- $$$mouseReleaseEvent[overload1]$$$mouseReleaseEventQMouseEvent* -->
<h3 class="fn"><a name="mouseReleaseEvent"></a><span class="type">void</span> QMenuBar::<span class="name">mouseReleaseEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>().</p>
<!-- @@@mouseReleaseEvent -->
<!-- $$$paintEvent[overload1]$$$paintEventQPaintEvent* -->
<h3 class="fn"><a name="paintEvent"></a><span class="type">void</span> QMenuBar::<span class="name">paintEvent</span> ( <span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>().</p>
<!-- @@@paintEvent -->
<!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* -->
<h3 class="fn"><a name="resizeEvent"></a><span class="type">void</span> QMenuBar::<span class="name">resizeEvent</span> ( <span class="type"><a href="qresizeevent.html">QResizeEvent</a></span> * )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget::resizeEvent</a>().</p>
<!-- @@@resizeEvent -->
<!-- $$$setActiveAction[overload1]$$$setActiveActionQAction* -->
<h3 class="fn"><a name="setActiveAction"></a><span class="type">void</span> QMenuBar::<span class="name">setActiveAction</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>act</i> )</h3>
<p>Sets the currently highlighted action to <i>act</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qmenubar.html#activeAction">activeAction</a>().</p>
<!-- @@@setActiveAction -->
<!-- $$$setCornerWidget[overload1]$$$setCornerWidgetQWidget*Qt::Corner -->
<h3 class="fn"><a name="setCornerWidget"></a><span class="type">void</span> QMenuBar::<span class="name">setCornerWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i>, <span class="type"><a href="qt.html#Corner-enum">Qt::Corner</a></span> <i>corner</i> = Qt::TopRightCorner )</h3>
<p>This sets the given <i>widget</i> to be shown directly on the left of the first menu item, or on the right of the last menu item, depending on <i>corner</i>.</p>
<p>The menu bar takes ownership of <i>widget</i>, reparenting it into the menu bar. However, if the <i>corner</i> already contains a widget, this previous widget will no longer be managed and will still be a visible child of the menu bar.</p>
<p><b>Note:</b> Using a corner other than <a href="qt.html#Corner-enum">Qt::TopRightCorner</a> or <a href="qt.html#Corner-enum">Qt::TopLeftCorner</a> will result in a warning.</p>
<p><b>See also </b><a href="qmenubar.html#cornerWidget">cornerWidget</a>().</p>
<!-- @@@setCornerWidget -->
<!-- $$$setDefaultAction[overload1]$$$setDefaultActionQAction* -->
<h3 class="fn"><a name="setDefaultAction"></a><span class="type">void</span> QMenuBar::<span class="name">setDefaultAction</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>act</i> )</h3>
<p>Sets the default action to <i>act</i>.</p>
<p>The default action is assigned to the left soft key. The menu is assigned to the right soft key.</p>
<p>Currently there is only support for the default action on Windows Mobile. On all other platforms this method is not available.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qmenubar.html#defaultAction">defaultAction</a>().</p>
<!-- @@@setDefaultAction -->
<!-- $$$setVisible[overload1]$$$setVisiblebool -->
<h3 class="fn"><a name="setVisible"></a><span class="type">void</span> QMenuBar::<span class="name">setVisible</span> ( <span class="type">bool</span> <i>visible</i> )<tt> [virtual slot]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget::setVisible</a>().</p>
<!-- @@@setVisible -->
<!-- $$$sizeHint[overload1]$$$sizeHint -->
<h3 class="fn"><a name="sizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QMenuBar::<span class="name">sizeHint</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>().</p>
<!-- @@@sizeHint -->
<!-- $$$timerEvent[overload1]$$$timerEventQTimerEvent* -->
<h3 class="fn"><a name="timerEvent"></a><span class="type">void</span> QMenuBar::<span class="name">timerEvent</span> ( <span class="type"><a href="qtimerevent.html">QTimerEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#timerEvent">QObject::timerEvent</a>().</p>
<!-- @@@timerEvent -->
<!-- $$$triggered[overload1]$$$triggeredQAction* -->
<h3 class="fn"><a name="triggered"></a><span class="type">void</span> QMenuBar::<span class="name">triggered</span> ( <span class="type"><a href="qaction.html">QAction</a></span> * <i>action</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when an action in a menu belonging to this menubar is triggered as a result of a mouse click; <i>action</i> is the action that caused the signal to be emitted.</p>
<p><b>Note:</b> <a href="qmenubar.html">QMenuBar</a> has to have ownership of the <a href="qmenu.html">QMenu</a> in order this signal to work.</p>
<p>Normally, you connect each menu action to a single slot using <a href="qaction.html#triggered">QAction::triggered</a>(), but sometimes you will want to connect several items to a single slot (most often if the user selects from an array). This signal is useful in such cases.</p>
<p><b>See also </b><a href="qmenubar.html#hovered">hovered</a>() and <a href="qaction.html#triggered">QAction::triggered</a>().</p>
<!-- @@@triggered -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>