This file is indexed.

/usr/share/qt3/doc/html/menu-example.html is in qt3-doc 3:3.3.8-b-8ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!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/examples/menu/menu.doc:4 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Using menus</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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>Using menus</h1>

   
<p> 
This example demonstrates a menu bar with pull-down menus,
sub-menus and custom menu items. It also demonstrates a pop-up
context menu.
<p> <hr>
<p> Header file:
<p> <pre>/****************************************************************************
** $Id: qt/menu.h   3.3.8   edited Jan 11 14:37 $
**
** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
**
** This file is part of an example program for Qt.  This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/

#ifndef MENU_H
#define MENU_H

#include &lt;<a href="qwidget-h.html">qwidget.h</a>&gt;
#include &lt;<a href="qmenubar-h.html">qmenubar.h</a>&gt;
#include &lt;<a href="qlabel-h.html">qlabel.h</a>&gt;


class MenuExample : public <a href="qwidget.html">QWidget</a>
{
    <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
public:
    MenuExample( <a href="qwidget.html">QWidget</a> *parent=0, const char *name=0 );

public slots:
    void open();
    void news();
    void save();
    void closeDoc();
    void undo();
    void redo();
    void normal();
    void bold();
    void underline();
    void about();
    void aboutQt();
    void printer();
    void file();
    void fax();
    void printerSetup();

protected:
    void    resizeEvent( <a href="qresizeevent.html">QResizeEvent</a> * );

signals:
    void    explain( const <a href="qstring.html">QString</a>&amp; );

private:
    void contextMenuEvent ( <a href="qcontextmenuevent.html">QContextMenuEvent</a> * );


    <a href="qmenubar.html">QMenuBar</a> *menu;
    <a href="qlabel.html">QLabel</a>   *label;
    bool isBold;
    bool isUnderline;
    int boldID, underlineID;
};


#endif // MENU_H
</pre>

<p> <hr>
<p> Implementation:
<p> <pre>/****************************************************************************
** $Id: qt/menu.cpp   3.3.8   edited Jan 11 14:37 $
**
** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
**
** This file is part of an example program for Qt.  This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/

#include "menu.h"
#include &lt;<a href="qcursor-h.html">qcursor.h</a>&gt;
#include &lt;<a href="qpopupmenu-h.html">qpopupmenu.h</a>&gt;
#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;
#include &lt;<a href="qmessagebox-h.html">qmessagebox.h</a>&gt;
#include &lt;<a href="qpixmap-h.html">qpixmap.h</a>&gt;
#include &lt;<a href="qpainter-h.html">qpainter.h</a>&gt;

/* XPM */
static const char * p1_xpm[] = {
"16 16 3 1",
"       c None",
".      c #000000000000",
"X      c #FFFFFFFF0000",
"                ",
"                ",
"         ....   ",
"        .XXXX.  ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .XXXXXXXXXXXX. ",
" .............. ",
"                "};

/* XPM */
static const char * p2_xpm[] = {
"16 16 3 1",
"       c None",
".      c #000000000000",
"X      c #FFFFFFFFFFFF",
"                ",
"   ......       ",
"   .XXX.X.      ",
"   .XXX.XX.     ",
"   .XXX.XXX.    ",
"   .XXX.....    ",
"   .XXXXXXX.    ",
"   .XXXXXXX.    ",
"   .XXXXXXX.    ",
"   .XXXXXXX.    ",
"   .XXXXXXX.    ",
"   .XXXXXXX.    ",
"   .XXXXXXX.    ",
"   .........    ",
"                ",
"                "};

/* XPM */
static const char * p3_xpm[] = {
"16 16 3 1",
"       c None",
".      c #000000000000",
"X      c #FFFFFFFFFFFF",
"                ",
"                ",
"   .........    ",
"  ...........   ",
"  ........ ..   ",
"  ...........   ",
"  ...........   ",
"  ...........   ",
"  ...........   ",
"  ...XXXXX...   ",
"  ...XXXXX...   ",
"  ...XXXXX...   ",
"  ...XXXXX...   ",
"   .........    ",
"                ",
"                "};


/*
  Auxiliary class to provide fancy menu items with different
  fonts. Used for the "bold" and "underline" menu items in the options
  menu.
 */
class MyMenuItem : public <a href="qcustommenuitem.html">QCustomMenuItem</a>
{
public:
    MyMenuItem( const <a href="qstring.html">QString</a>&amp; s, const <a href="qfont.html">QFont</a>&amp; f )
        : string( s ), font( f ){};
    ~MyMenuItem(){}

    void paint( <a href="qpainter.html">QPainter</a>* p, const QColorGroup&amp; /*cg*/, bool /*act*/, bool /*enabled*/, int x, int y, int w, int h )
    {
        p-&gt;<a href="qpainter.html#setFont">setFont</a> ( font );
        p-&gt;<a href="qpainter.html#drawText">drawText</a>( x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, string );
    }

    <a href="qsize.html">QSize</a> sizeHint()
    {
        return QFontMetrics( font ).size( AlignLeft | AlignVCenter | ShowPrefix | DontClip,  string );
    }
private:
    <a href="qstring.html">QString</a> string;
    <a href="qfont.html">QFont</a> font;
};


<a name="f501"></a>MenuExample::MenuExample( <a href="qwidget.html">QWidget</a> *parent, const char *name )
    : <a href="qwidget.html">QWidget</a>( parent, name )
{
    <a href="qpixmap.html">QPixmap</a> p1( p1_xpm );
    <a href="qpixmap.html">QPixmap</a> p2( p2_xpm );
    <a href="qpixmap.html">QPixmap</a> p3( p3_xpm );
    <a href="qpopupmenu.html">QPopupMenu</a> *print = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( print );
<a name="x1879"></a>    print-&gt;<a href="qpopupmenu.html#insertTearOffHandle">insertTearOffHandle</a>();
<a name="x1869"></a>    print-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Print to printer", this, SLOT(printer()) );
    print-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "Print to &amp;file", this, SLOT(file()) );
    print-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "Print to fa&amp;x", this, SLOT(fax()) );
<a name="x1870"></a>    print-&gt;<a href="qmenudata.html#insertSeparator">insertSeparator</a>();
    print-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "Printer &amp;Setup", this, SLOT(printerSetup()) );

    <a href="qpopupmenu.html">QPopupMenu</a> *file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( file );
    file-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( p1, "&amp;Open",  this, SLOT(open()), CTRL+Key_O );
    file-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( p2, "&amp;New", this, SLOT(news()), CTRL+Key_N );
    file-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( p3, "&amp;Save", this, SLOT(save()), CTRL+Key_S );
    file-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Close", this, SLOT(closeDoc()), CTRL+Key_W );
    file-&gt;<a href="qmenudata.html#insertSeparator">insertSeparator</a>();
    file-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Print", print, CTRL+Key_P );
    file-&gt;<a href="qmenudata.html#insertSeparator">insertSeparator</a>();
    file-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "E&amp;xit",  qApp, SLOT(<a href="qapplication.html#quit">quit</a>()), CTRL+Key_Q );

    <a href="qpopupmenu.html">QPopupMenu</a> *edit = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( edit );
    int undoID = edit-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Undo", this, SLOT(undo()) );
    int redoID = edit-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Redo", this, SLOT(redo()) );
<a name="x1873"></a>    edit-&gt;<a href="qmenudata.html#setItemEnabled">setItemEnabled</a>( undoID, FALSE );
    edit-&gt;<a href="qmenudata.html#setItemEnabled">setItemEnabled</a>( redoID, FALSE );

    <a href="qpopupmenu.html">QPopupMenu</a>* options = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( options );
    options-&gt;<a href="qpopupmenu.html#insertTearOffHandle">insertTearOffHandle</a>();
    options-&gt;<a href="qwidget.html#setCaption">setCaption</a>("Options");
    options-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Normal Font", this, SLOT(normal()) );
    options-&gt;<a href="qmenudata.html#insertSeparator">insertSeparator</a>();

<a name="x1883"></a>    options-&gt;<a href="qwidget.html#polish">polish</a>(); // adjust system settings
<a name="x1882"></a>    <a href="qfont.html">QFont</a> f = options-&gt;<a href="qwidget.html#font">font</a>();
<a name="x1860"></a>    f.<a href="qfont.html#setBold">setBold</a>( TRUE );
    boldID = options-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( new MyMenuItem( "Bold", f ) );
<a name="x1871"></a>    options-&gt;<a href="qmenudata.html#setAccel">setAccel</a>( CTRL+Key_B, boldID );
<a name="x1868"></a>    options-&gt;<a href="qmenudata.html#connectItem">connectItem</a>( boldID, this, SLOT(bold()) );
    f = <a href="qwidget.html#font">font</a>();
<a name="x1861"></a>    f.<a href="qfont.html#setUnderline">setUnderline</a>( TRUE );
    underlineID = options-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( new MyMenuItem( "Underline", f ) );
    options-&gt;<a href="qmenudata.html#setAccel">setAccel</a>( CTRL+Key_U, underlineID );
    options-&gt;<a href="qmenudata.html#connectItem">connectItem</a>( underlineID, this, SLOT(underline()) );

    isBold = FALSE;
    isUnderline = FALSE;
<a name="x1880"></a>    options-&gt;<a href="qpopupmenu.html#setCheckable">setCheckable</a>( TRUE );


    <a href="qpopupmenu.html">QPopupMenu</a> *help = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( help );
    help-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;About", this, SLOT(about()), CTRL+Key_H );
    help-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "About &amp;Qt", this, SLOT(aboutQt()) );

    // If we used a QMainWindow we could use its built-in menuBar().
    menu = new <a href="qmenubar.html">QMenuBar</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( menu );
    menu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;File", file );
    menu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Edit", edit );
    menu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Options", options );
    menu-&gt;<a href="qmenudata.html#insertSeparator">insertSeparator</a>();
    menu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Help", help );
<a name="x1867"></a>    menu-&gt;<a href="qmenubar.html#setSeparator">setSeparator</a>( QMenuBar::InWindowsStyle );


    <a href="qlabel.html">QLabel</a> *msg = new <a href="qlabel.html">QLabel</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( msg );
    msg-&gt;<a href="qlabel.html#setText">setText</a>( "A context menu is available.\n"
                  "Invoke it by right-clicking or by"
                  " pressing the 'context' button." );
<a name="x1886"></a>    msg-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( 0, height() - 60, width(), 60 );
<a name="x1864"></a>    msg-&gt;<a href="qlabel.html#setAlignment">setAlignment</a>( AlignCenter );

    label = new <a href="qlabel.html">QLabel</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( label );
    label-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( 20, rect().center().y()-20, width()-40, 40 );
    label-&gt;<a href="qframe.html#setFrameStyle">setFrameStyle</a>( QFrame::Box | QFrame::Raised );
<a name="x1863"></a>    label-&gt;<a href="qframe.html#setLineWidth">setLineWidth</a>( 1 );
    label-&gt;<a href="qlabel.html#setAlignment">setAlignment</a>( AlignCenter );

    <a href="qobject.html#connect">connect</a>( this,  SIGNAL(explain(const <a href="qstring.html">QString</a>&amp;)),
             label, SLOT(<a href="qlabel.html#setText">setText</a>(const <a href="qstring.html">QString</a>&amp;)) );

    <a href="qwidget.html#setMinimumSize">setMinimumSize</a>( 100, 80 );
    <a href="qwidget.html#setFocusPolicy">setFocusPolicy</a>( QWidget::ClickFocus );
}


<a name="x1881"></a>void MenuExample::<a href="qwidget.html#contextMenuEvent">contextMenuEvent</a>( <a href="qcontextmenuevent.html">QContextMenuEvent</a> * )
{
    <a href="qpopupmenu.html">QPopupMenu</a>* contextMenu = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( contextMenu );
    <a href="qlabel.html">QLabel</a> *caption = new <a href="qlabel.html">QLabel</a>( "&lt;font color=darkblue&gt;&lt;u&gt;&lt;b&gt;"
        "Context Menu&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;", this );
    caption-&gt;<a href="qlabel.html#setAlignment">setAlignment</a>( Qt::AlignCenter );
    contextMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( caption );
    contextMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;New",  this, SLOT(news()), CTRL+Key_N );
    contextMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Open...", this, SLOT(open()), CTRL+Key_O );
    contextMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Save", this, SLOT(save()), CTRL+Key_S );
    <a href="qpopupmenu.html">QPopupMenu</a> *submenu = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
    <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( submenu );
    submenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Print to printer", this, SLOT(printer()) );
    submenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "Print to &amp;file", this, SLOT(file()) );
    submenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "Print to fa&amp;x", this, SLOT(fax()) );
    contextMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;Print", submenu );
<a name="x1878"></a><a name="x1859"></a>    contextMenu-&gt;<a href="qpopupmenu.html#exec">exec</a>( QCursor::<a href="qcursor.html#pos">pos</a>() );
    delete contextMenu;
}


void <a name="f502"></a>MenuExample::open()
{
    emit explain( "File/Open selected" );
}


void <a name="f503"></a>MenuExample::news()
{
    emit explain( "File/New selected" );
}

void <a name="f504"></a>MenuExample::save()
{
    emit explain( "File/Save selected" );
}


void <a name="f505"></a>MenuExample::closeDoc()
{
    emit explain( "File/Close selected" );
}


void <a name="f506"></a>MenuExample::undo()
{
    emit explain( "Edit/Undo selected" );
}


void <a name="f507"></a>MenuExample::redo()
{
    emit explain( "Edit/Redo selected" );
}


void <a name="f508"></a>MenuExample::normal()
{
    isBold = FALSE;
    isUnderline = FALSE;
    <a href="qfont.html">QFont</a> font;
<a name="x1865"></a>    label-&gt;<a href="qlabel.html#setFont">setFont</a>( font );
<a name="x1872"></a>    menu-&gt;<a href="qmenudata.html#setItemChecked">setItemChecked</a>( boldID, isBold );
    menu-&gt;<a href="qmenudata.html#setItemChecked">setItemChecked</a>( underlineID, isUnderline );
    emit explain( "Options/Normal selected" );
}


void <a name="f509"></a>MenuExample::bold()
{
    isBold = !isBold;
    <a href="qfont.html">QFont</a> font;
    font.<a href="qfont.html#setBold">setBold</a>( isBold );
    font.<a href="qfont.html#setUnderline">setUnderline</a>( isUnderline );
    label-&gt;<a href="qlabel.html#setFont">setFont</a>( font );
    menu-&gt;<a href="qmenudata.html#setItemChecked">setItemChecked</a>( boldID, isBold );
    emit explain( "Options/Bold selected" );
}


void <a name="f510"></a>MenuExample::underline()
{
    isUnderline = !isUnderline;
    <a href="qfont.html">QFont</a> font;
    font.<a href="qfont.html#setBold">setBold</a>( isBold );
    font.<a href="qfont.html#setUnderline">setUnderline</a>( isUnderline );
    label-&gt;<a href="qlabel.html#setFont">setFont</a>( font );
    menu-&gt;<a href="qmenudata.html#setItemChecked">setItemChecked</a>( underlineID, isUnderline );
    emit explain( "Options/Underline selected" );
}


void <a name="f511"></a>MenuExample::about()
{
<a name="x1874"></a>    QMessageBox::<a href="qmessagebox.html#about">about</a>( this, "Qt Menu Example",
                        "This example demonstrates simple use of Qt menus.\n"
                        "You can cut and paste lines from it to your own\n"
                        "programs." );
}


void <a name="f512"></a>MenuExample::aboutQt()
{
<a name="x1875"></a>    QMessageBox::<a href="qmessagebox.html#aboutQt">aboutQt</a>( this, "Qt Menu Example" );
}


void <a name="f513"></a>MenuExample::printer()
{
    emit explain( "File/Printer/Print selected" );
}

void <a name="f514"></a>MenuExample::file()
{
    emit explain( "File/Printer/Print To File selected" );
}

void <a name="f515"></a>MenuExample::fax()
{
    emit explain( "File/Printer/Print To Fax selected" );
}

void <a name="f516"></a>MenuExample::printerSetup()
{
    emit explain( "File/Printer/Printer Setup selected" );
}


<a name="x1884"></a>void MenuExample::<a href="qwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">QResizeEvent</a> * )
{
    label-&gt;<a href="qwidget.html#setGeometry">setGeometry</a>( 20, rect().center().y()-20, width()-40, 40 );
}


int main( int argc, char ** argv )
{
    <a href="qapplication.html">QApplication</a> a( argc, argv );
    MenuExample m;
    m.<a href="qwidget.html#setCaption">setCaption</a>("Qt Examples - Menus");
    a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &amp;m );
    m.<a href="qwidget.html#show">show</a>();
    return a.<a href="qapplication.html#exec">exec</a>();
}
</pre>

<p>See also <a href="examples.html">Examples</a>.

<!-- eof -->
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 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>