Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1533

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/widgets/qmenubar.cpp:72 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QMenuBar Class</title>
<style type="text/css"><!--
h3.fn,span.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>QMenuBar Class Reference</h1>

<p>The QMenuBar class provides a horizontal menu bar.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qmenubar-h.html">qmenubar.h</a>&gt;</tt>
<p>Inherits <a href="qframe.html">QFrame</a> and <a href="qmenudata.html">QMenuData</a>.
<p><a href="qmenubar-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QMenuBar"><b>QMenuBar</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn><a href="#~QMenuBar"><b>~QMenuBar</b></a> ()</div></li>
<li><div class=fn>virtual void <a href="#show"><b>show</b></a> ()</div></li>
<li><div class=fn>virtual void <a href="#hide"><b>hide</b></a> ()</div></li>
<li><div class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int&nbsp;max_width ) const</div></li>
<li><div class=fn>enum <a href="#Separator-enum"><b>Separator</b></a> { Never = 0, InWindowsStyle = 1 }</div></li>
<li><div class=fn>Separator separator () const &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>virtual void setSeparator ( Separator&nbsp;when ) &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>void <a href="#setDefaultUp"><b>setDefaultUp</b></a> ( bool )</div></li>
<li><div class=fn>bool <a href="#isDefaultUp"><b>isDefaultUp</b></a> () const</div></li>
</ul>
<h2>Signals</h2>
<ul>
<li><div class=fn>void <a href="#activated"><b>activated</b></a> ( int&nbsp;id )</div></li>
<li><div class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( int&nbsp;id )</div></li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class=fn>void <b>initialize</b> ()</div></li>
<li><div class=fn>void <b>cleanup</b> ()</div></li>
</ul>
<h2>Important Inherited Members</h2>
<ul>
<li><div class=fn>int <a href="#insertItem"><b>insertItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;QKeySequence&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-2"><b>insertItem</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;icon, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;QKeySequence&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-3"><b>insertItem</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, const&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;QKeySequence&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-4"><b>insertItem</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;icon, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, const&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;QKeySequence&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-5"><b>insertItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-6"><b>insertItem</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;icon, const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-7"><b>insertItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, QPopupMenu&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-8"><b>insertItem</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;icon, const&nbsp;QString&nbsp;&amp;&nbsp;text, QPopupMenu&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-9"><b>insertItem</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-a"><b>insertItem</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;icon, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-b"><b>insertItem</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, QPopupMenu&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-c"><b>insertItem</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;icon, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, QPopupMenu&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-d"><b>insertItem</b></a> ( QWidget&nbsp;*&nbsp;widget, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-e"><b>insertItem</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;icon, QCustomMenuItem&nbsp;*&nbsp;custom, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertItem-f"><b>insertItem</b></a> ( QCustomMenuItem&nbsp;*&nbsp;custom, int&nbsp;id = -1, int&nbsp;index = -1 )</div></li>
<li><div class=fn>int <a href="#insertSeparator"><b>insertSeparator</b></a> ( int&nbsp;index = -1 )</div></li>
<li><div class=fn>void <a href="#removeItem"><b>removeItem</b></a> ( int&nbsp;id )</div></li>
<li><div class=fn>void <a href="#clear"><b>clear</b></a> ()</div></li>
<li><div class=fn>bool <a href="#isItemEnabled"><b>isItemEnabled</b></a> ( int&nbsp;id ) const</div></li>
<li><div class=fn>void <a href="#setItemEnabled"><b>setItemEnabled</b></a> ( int&nbsp;id, bool&nbsp;enable )</div></li>
</ul>
<h2>Properties</h2>
<ul>
<li><div class=fn>bool <a href="#defaultUp-prop"><b>defaultUp</b></a>&nbsp;- the popup orientation</div></li>
<li><div class=fn>Separator separator&nbsp;- in which cases a menubar sparator is drawn &nbsp;<em>(obsolete)</em></div></li>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class=fn>virtual void <a href="#drawContents"><b>drawContents</b></a> ( QPainter&nbsp;*&nbsp;p )</div></li>
<li><div class=fn>virtual void <a href="#menuContentsChanged"><b>menuContentsChanged</b></a> ()</div></li>
<li><div class=fn>virtual void <a href="#menuStateChanged"><b>menuStateChanged</b></a> ()</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


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="qmenudata.html#insertItem">insertItem()</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="qpopupmenu.html">QPopupMenu</a>, the following statement inserts the menu into
the menu bar:
<pre>
  menubar-&gt;insertItem( "&amp;File", filemenu );
  </pre>
 
The ampersand in the menu
item's text sets Alt+F as a shortcut for this menu. (You can use
"&&" to get a real ampersand in the menu bar.)
<p> Items are either enabled or disabled. You toggle their state with
<a href="qmenudata.html#setItemEnabled">setItemEnabled</a>().
<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> 
<p> Example of creating a menu bar with menu items (from <a href="menu-example.html">menu/menu.cpp</a>):


<pre>        <a href="qpopupmenu.html">QPopupMenu</a> *file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
</pre><pre>        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 );
</pre><pre>        menu = new QMenuBar( this );
</pre><pre>        menu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "&amp;File", file );
</pre>
<p> In most main window style applications you would use the menuBar()
provided in <a href="qmainwindow.html">QMainWindow</a>, adding <a href="qpopupmenu.html">QPopupMenu</a>s to the menu bar
and adding <a href="qaction.html">QAction</a>s to the popup menus.
<p> Example (from <a href="qaction-application-example.html">action/application.cpp</a>):


<pre>        <a href="qpopupmenu.html">QPopupMenu</a> * file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
        <a href="qmainwindow.html#menuBar">menuBar</a>()-&gt;insertItem( "&amp;File", file );
        fileNewAction-&gt;<a href="qaction.html#addTo">addTo</a>( file );
</pre>
<p> Menu items can have text and pixmaps (or iconsets), see the
various <a href="qmenudata.html#insertItem">insertItem()</a>
overloads, as well as separators, see <a href="qmenudata.html#insertSeparator">insertSeparator()</a>. You can
also add custom menu items that are derived from
<a href="qcustommenuitem.html">QCustomMenuItem</a>.
<p> Menu items may be removed with <a href="qmenudata.html#removeItem">removeItem</a>() and enabled or disabled
with <a href="qmenudata.html#setItemEnabled">setItemEnabled()</a>.
<p> QMenuBar on Qt/Mac is a wrapper for using the system-wide
menubar. However if you have multiple menubars in one dialog the
outermost menubar (normally inside a widget with <a href="qt.html#WidgetFlags-enum">WType_TopLevel</a>) will
be used for the global menubar.
<p> <img src=qmenubar-m.png> <img src=qmenubar-w.png>
<p> <p>See also <a href="qpopupmenu.html">QPopupMenu</a>, <a href="qaccel.html">QAccel</a>, <a href="qaction.html">QAction</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Menu Bar</a> and <a href="application.html">Main Window and Related Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Separator-enum"></a>QMenuBar::Separator</h3> 
<p> This enum type is used to decide whether QMenuBar should draw a
separator line at its bottom.	 The possible values are:
<ul>
<li><tt>QMenuBar::Never</tt> - In many applications there is already a separator,
and having two looks wrong.
<li><tt>QMenuBar::InWindowsStyle</tt> - In some other applications a separator
looks good in Windows style, but nowhere else.
</ul><p> 
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QMenuBar"></a>QMenuBar::QMenuBar ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a menu bar with a <em>parent</em> and a <em>name</em>.

<h3 class=fn><a name="~QMenuBar"></a>QMenuBar::~QMenuBar ()
</h3>
Destroys the menu bar.

<h3 class=fn>void <a name="activated"></a>QMenuBar::activated ( int&nbsp;id )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when a menu item is selected; <em>id</em> is the id
of the selected item.
<p> Normally you will connect each menu item to a single slot using
<a href="qmenudata.html#insertItem">QMenuData::insertItem</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>See also <a href="#highlighted">highlighted</a>() and <a href="qmenudata.html#insertItem">QMenuData::insertItem</a>().

<p>Example: <a href="progress-example.html#x837">progress/progress.cpp</a>.
<h3 class=fn>void <a name="clear"></a>QMenuData::clear ()
</h3>
Removes all menu items.
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>() and <a href="qmenudata.html#removeItemAt">removeItemAt</a>().

<p>Examples: <a href="mdi-example.html#x1147">mdi/application.cpp</a> and <a href="qwerty-example.html#x632">qwerty/qwerty.cpp</a>.
<h3 class=fn>void <a name="drawContents"></a>QMenuBar::drawContents ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p )<tt> [virtual protected]</tt>
</h3>
Called from <a href="qframe.html#paintEvent">QFrame::paintEvent</a>().
Draws the menu bar contents using painter <em>p</em>.

<p>Reimplemented from <a href="qframe.html#drawContents">QFrame</a>.
<h3 class=fn>int <a name="heightForWidth"></a>QMenuBar::heightForWidth ( int&nbsp;max_width ) const<tt> [virtual]</tt>
</h3>
Returns the height that the menu would resize itself to if its parent
(and hence itself) resized to the given <em>max_width</em>.  This can be
useful for simple layout tasks in which the height of the menu bar
is needed after items have been inserted.  See
<a href="showimg-example.html">showimg/showimg.cpp</a> for an example of the usage.

<p>Example: <a href="showimg-example.html#x425">showimg/showimg.cpp</a>.
<p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget</a>.
<h3 class=fn>void <a name="hide"></a>QMenuBar::hide ()<tt> [virtual]</tt>
</h3>
Reimplements <a href="qwidget.html#hide">QWidget::hide</a>() in order to deselect any selected item, and
calls setUpLayout() for the main window.

<p>Example: <a href="grapher-nsplugin-example.html#x2597">grapher/grapher.cpp</a>.
<p>Reimplemented from <a href="qwidget.html#hide">QWidget</a>.
<h3 class=fn>void <a name="highlighted"></a>QMenuBar::highlighted ( int&nbsp;id )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when a menu item is highlighted; <em>id</em> is the
id of the highlighted item.
<p> Normally, you will connect each menu item to a single slot using
<a href="qmenudata.html#insertItem">QMenuData::insertItem</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>See also <a href="#activated">activated</a>() and <a href="qmenudata.html#insertItem">QMenuData::insertItem</a>().

<h3 class=fn>int <a name="insertItem"></a>QMenuData::insertItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;<a href="qkeysequence.html">QKeySequence</a>&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>
The family of <a href="qmenudata.html#insertItem">insertItem</a>() functions inserts menu items into a
popup menu or a menu bar.
<p> A menu item is usually either a text string or a pixmap, both with
an optional icon or keyboard accelerator. For special cases it is
also possible to insert custom items (see <a href="qcustommenuitem.html">QCustomMenuItem</a>) or even
widgets into popup menus.
<p> Some insertItem() members take a popup menu as an additional
argument. Use this to insert submenus to existing menus or pulldown
menus to a menu bar.
<p> The number of insert functions may look confusing, but they are actually
quite simple to use.
<p> This default version inserts a menu item with the text <em>text</em>, the
accelerator key <em>accel</em>, an id and an optional index and connects
it to the slot <em>member</em> in the object <em>receiver</em>.
<p> Example:
<pre>
    QMenuBar   *mainMenu = new QMenuBar;
    <a href="qpopupmenu.html">QPopupMenu</a> *fileMenu = new <a href="qpopupmenu.html">QPopupMenu</a>;
    fileMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "New",  myView, SLOT(newFile()), CTRL+Key_N );
    fileMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "Open", myView, SLOT(open()),    CTRL+Key_O );
    mainMenu-&gt;<a href="qmenudata.html#insertItem">insertItem</a>( "File", fileMenu );
  </pre>
 
<p> Not all insert functions take an object/slot parameter or an
accelerator key. Use <a href="qmenudata.html#connectItem">connectItem</a>() and <a href="qmenudata.html#setAccel">setAccel</a>() on these items.
<p> If you need to translate accelerators, use <a href="qobject.html#tr">tr</a>() with a string
description that use pass to the <a href="qkeysequence.html">QKeySequence</a> constructor:
<pre>
    fileMenu-&gt;insertItem( <a href="qobject.html#tr">tr</a>("Open"), myView, SLOT(open()),
                         <a href="qobject.html#tr">tr</a>("Ctrl+O") );
  </pre>
 
<p> In the example above, pressing Ctrl+N or selecting "Open" from the
menu activates the myView->open() function.
<p> Some insert functions take a <a href="qiconset.html">QIconSet</a> parameter to specify the
little menu item icon. Note that you can always pass a <a href="qpixmap.html">QPixmap</a>
object instead.
<p> The <em>index</em> specifies the position in the menu.  The menu item is
appended at the end of the list if <em>index</em> is negative.
<p> Note that keyboard accelerators in Qt are not application-global,
instead they are bound to a certain top-level window. For example,
accelerators in <a href="qpopupmenu.html">QPopupMenu</a> items only work for menus that are
associated with a certain window. This is true for popup menus that
live in a menu bar since their accelerators will then be installed
in the menu bar itself. This also applies to stand-alone popup menus
that have a top-level widget in their <a href="qwidget.html#parentWidget">parentWidget</a>() chain. The menu
will then install its accelerator object on that top-level widget.
For all other cases use an independent <a href="qaccel.html">QAccel</a> object.
<p> <b>Warning:</b> Be careful when passing a literal 0 to <a href="qmenudata.html#insertItem">insertItem</a>() because
some C++ compilers choose the wrong overloaded function.
Cast the 0 to what you mean, e.g. <tt>(QObject*)0</tt>.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qaccel.html">QAccel</a> and <a href="qnamespace-h.html">qnamespace.h</a>.

<p>Examples: <a href="addressbook-example.html#x1960">addressbook/mainwindow.cpp</a>, <a href="canvas-example.html#x2536">canvas/canvas.cpp</a>, <a href="mdi-example.html#x1148">mdi/application.cpp</a>, <a href="menu-example.html#x1123">menu/menu.cpp</a>, <a href="qwerty-example.html#x633">qwerty/qwerty.cpp</a>, <a href="scrollview-example.html#x487">scrollview/scrollview.cpp</a> and <a href="showimg-example.html#x427">showimg/showimg.cpp</a>.
<h3 class=fn>int <a name="insertItem-2"></a>QMenuData::insertItem ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;icon, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;<a href="qkeysequence.html">QKeySequence</a>&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>,
accelerator <em>accel</em>, optional id <em>id</em>, and optional <em>index</em>. The
menu item is connected it to the <em>receiver</em>'s <em>member</em> slot. The
icon will be displayed to the left of the text in the item.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qaccel.html">QAccel</a> and <a href="qnamespace-h.html">qnamespace.h</a>.

<h3 class=fn>int <a name="insertItem-3"></a>QMenuData::insertItem ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, const&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;<a href="qkeysequence.html">QKeySequence</a>&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with pixmap <em>pixmap</em>, accelerator <em>accel</em>, optional id <em>id</em>, and optional <em>index</em>. The menu item is
connected it to the <em>receiver</em>'s <em>member</em> slot. The icon will be
displayed to the left of the text in the item.
<p> To look best when being highlighted as a menu item, the pixmap should
provide a mask (see <a href="qpixmap.html#mask">QPixmap::mask</a>()).
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-4"></a>QMenuData::insertItem ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;icon, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, const&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member, const&nbsp;<a href="qkeysequence.html">QKeySequence</a>&nbsp;&amp;&nbsp;accel = 0, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em>,
accelerator <em>accel</em>, optional id <em>id</em>, and optional <em>index</em>.
The icon will be displayed to the left of the pixmap in the item.
The item is connected to the <em>member</em> slot in the <em>receiver</em> object.
<p> To look best when being highlighted as a menu item, the pixmap should
provide a mask (see <a href="qpixmap.html#mask">QPixmap::mask</a>()).
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qaccel.html">QAccel</a> and <a href="qnamespace-h.html">qnamespace.h</a>.

<h3 class=fn>int <a name="insertItem-5"></a>QMenuData::insertItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with text <em>text</em>, optional id <em>id</em>, and
optional <em>index</em>.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-6"></a>QMenuData::insertItem ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;icon, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>,
optional id <em>id</em>, and optional <em>index</em>.
The icon will be displayed to the left of the text in the item.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-7"></a>QMenuData::insertItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qpopupmenu.html">QPopupMenu</a>&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with text <em>text</em>, submenu <em>popup</em>,
optional id <em>id</em>, and optional <em>index</em>.
<p> The <em>popup</em> must be deleted by the programmer or by its parent
widget.  It is not deleted when this menu item is removed or when
the menu is deleted.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-8"></a>QMenuData::insertItem ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;icon, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qpopupmenu.html">QPopupMenu</a>&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>,
submenu <em>popup</em>, optional id <em>id</em>, and optional <em>index</em>.
The icon will be displayed to the left of the text in the item.
<p> The <em>popup</em> must be deleted by the programmer or by its parent
widget.  It is not deleted when this menu item is removed or when
the menu is deleted.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-9"></a>QMenuData::insertItem ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with pixmap <em>pixmap</em>, optional id <em>id</em>, and optional <em>index</em>.
<p> To look best when being highlighted as a menu item, the pixmap should
provide a mask (see <a href="qpixmap.html#mask">QPixmap::mask</a>()).
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-a"></a>QMenuData::insertItem ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;icon, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em>,
optional id <em>id</em>, and optional <em>index</em>.
The icon will be displayed to the left of the pixmap in the item.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-b"></a>QMenuData::insertItem ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, <a href="qpopupmenu.html">QPopupMenu</a>&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with pixmap <em>pixmap</em>, submenu <em>popup</em>,
optional id <em>id</em>, and optional <em>index</em>.
<p> The <em>popup</em> must be deleted by the programmer or by its parent
widget.  It is not deleted when this menu item is removed or when
the menu is deleted.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-c"></a>QMenuData::insertItem ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;icon, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, <a href="qpopupmenu.html">QPopupMenu</a>&nbsp;*&nbsp;popup, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em>
submenu <em>popup</em>, optional id <em>id</em>, and optional <em>index</em>.
The icon will be displayed to the left of the pixmap in the item.
<p> The <em>popup</em> must be deleted by the programmer or by its parent
widget.  It is not deleted when this menu item is removed or when
the menu is deleted.
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>() and <a href="qmenudata.html#connectItem">connectItem</a>().

<h3 class=fn>int <a name="insertItem-d"></a>QMenuData::insertItem ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;widget, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item that consists of the widget <em>widget</em> with
optional id <em>id</em>, and optional <em>index</em>.
<p> Ownership of <em>widget</em> is transferred to the popup menu or to the
menu bar.
<p> Theoretically, any widget can be inserted into a popup menu. In
practice, this only makes sense with certain widgets.
<p> If a widget is not focus-enabled (see <a href="qwidget.html#isFocusEnabled">QWidget::isFocusEnabled</a>()),
the menu treats it as a separator; this means that the item is not
selectable and will never get focus. In this way you can, for example,
simply insert a <a href="qlabel.html">QLabel</a> if you need a popup menu with a title.
<p> If the widget is focus-enabled it will get focus when the user
traverses the popup menu with the arrow keys. If the widget does not
accept ArrowUp and ArrowDown in its key event handler, the focus
will move back to the menu when the respective arrow key is hit
one more time. This works with a <a href="qlineedit.html">QLineEdit</a>, for example.  If the
widget accepts the arrow key itself, it must also provide the
possibility to put the focus back on the menu again by calling
<a href="qwidget.html#focusNextPrevChild">QWidget::focusNextPrevChild</a>(). Futhermore, if the
embedded widget closes the menu when the user made a selection, this
can be done safely by calling
<pre>
    if ( <a href="qwidget.html#isVisible">isVisible</a>() &amp;&amp;
         <a href="qwidget.html#parentWidget">parentWidget</a>() &amp;&amp;
         <a href="qwidget.html#parentWidget">parentWidget</a>()-&gt;inherits("QPopupMenu") )
        <a href="qwidget.html#parentWidget">parentWidget</a>()-&gt;close();
  </pre>
 
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>().

<h3 class=fn>int <a name="insertItem-e"></a>QMenuData::insertItem ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;icon, <a href="qcustommenuitem.html">QCustomMenuItem</a>&nbsp;*&nbsp;custom, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a custom menu item <em>custom</em> with an <em>icon</em> and with
optional id <em>id</em>, and optional <em>index</em>.
<p> This only works with popup menus. It is not supported for menu bars.
Ownership of <em>custom</em> is transferred to the popup menu.
<p> If you want to connect a custom item to a certain slot, use <a href="qmenudata.html#connectItem">connectItem</a>().
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qmenudata.html#removeItem">removeItem</a>() and <a href="qcustommenuitem.html">QCustomMenuItem</a>.

<h3 class=fn>int <a name="insertItem-f"></a>QMenuData::insertItem ( <a href="qcustommenuitem.html">QCustomMenuItem</a>&nbsp;*&nbsp;custom, int&nbsp;id = -1, int&nbsp;index = -1 )
</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a custom menu item <em>custom</em> with
optional id <em>id</em>, and optional <em>index</em>.
<p> This only works with popup menus. It is not supported for menu bars.
Ownership of <em>custom</em> is transferred to the popup menu.
<p> If you want to connect a custom item to a certain slot, use <a href="qmenudata.html#connectItem">connectItem</a>().
<p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p> <p>See also <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qmenudata.html#removeItem">removeItem</a>() and <a href="qcustommenuitem.html">QCustomMenuItem</a>.

<h3 class=fn>int <a name="insertSeparator"></a>QMenuData::insertSeparator ( int&nbsp;index = -1 )
</h3>
Inserts a separator at position <em>index</em>.
The separator becomes the last menu item if <em>index</em> is negative.
<p> In a popup menu a separator is rendered as a horizontal line.  In a
Motif menu bar a separator is spacing, so the rest of the items
(normally just "Help") are drawn right-justified.  In a Windows
menu bar separators are ignored (to comply with the Windows style
guidelines).

<p>Examples: <a href="addressbook-example.html#x1961">addressbook/mainwindow.cpp</a>, <a href="mdi-example.html#x1149">mdi/application.cpp</a>, <a href="menu-example.html#x1124">menu/menu.cpp</a>, <a href="progress-example.html#x839">progress/progress.cpp</a>, <a href="scrollview-example.html#x488">scrollview/scrollview.cpp</a>, <a href="showimg-example.html#x428">showimg/showimg.cpp</a> and <a href="sound-example.html#x2482">sound/sound.cpp</a>.
<h3 class=fn>bool <a name="isDefaultUp"></a>QMenuBar::isDefaultUp () const
</h3><p>Returns the popup orientation.
See the <a href="qmenubar.html#defaultUp-prop">"defaultUp"</a> property for details.
<h3 class=fn>bool <a name="isItemEnabled"></a>QMenuData::isItemEnabled ( int&nbsp;id ) const
</h3>
Returns TRUE if the item with identifier <em>id</em> is enabled; otherwise
returns FALSE
<p>See also <a href="qmenudata.html#setItemEnabled">setItemEnabled</a>().

<h3 class=fn>void <a name="menuContentsChanged"></a>QMenuBar::menuContentsChanged ()<tt> [virtual protected]</tt>
</h3>
Recomputes the menu bar's display data according to the new
contents.
<p> You should never need to call this; it is called automatically by
<a href="qmenudata.html">QMenuData</a> whenever it needs to be called.

<p>Reimplemented from <a href="qmenudata.html#menuContentsChanged">QMenuData</a>.
<h3 class=fn>void <a name="menuStateChanged"></a>QMenuBar::menuStateChanged ()<tt> [virtual protected]</tt>
</h3>
Recomputes the menu bar's display data according to the new
state.
<p> You should never need to call this; it is called automatically by
<a href="qmenudata.html">QMenuData</a> whenever it needs to be called.

<p>Reimplemented from <a href="qmenudata.html#menuStateChanged">QMenuData</a>.
<h3 class=fn>void <a name="removeItem"></a>QMenuData::removeItem ( int&nbsp;id )
</h3>

Removes the menu item that has the identifier <em>id</em>.
<p>See also <a href="qmenudata.html#removeItemAt">removeItemAt</a>() and <a href="qmenudata.html#clear">clear</a>().

<h3 class=fn><a href="qmenubar.html#Separator-enum">Separator</a> <a name="separator"></a>QMenuBar::separator () const
</h3><p>Returns in which cases a menubar sparator is drawn.
See the <a href="qmenubar.html#separator-prop">"separator"</a> property for details.
<h3 class=fn>void <a name="setDefaultUp"></a>QMenuBar::setDefaultUp ( bool )
</h3><p>Sets the popup orientation.
See the <a href="qmenubar.html#defaultUp-prop">"defaultUp"</a> property for details.
<h3 class=fn>void <a name="setItemEnabled"></a>QMenuData::setItemEnabled ( int&nbsp;id, bool&nbsp;enable )
</h3>
If <em>enable</em> is TRUE, enables the menu item with identifier <em>id</em>;
otherwise disables the menu item with identifier <em>id</em>.
<p>See also <a href="qmenudata.html#isItemEnabled">isItemEnabled</a>().

<p>Examples: <a href="mdi-example.html#x1151">mdi/application.cpp</a>, <a href="menu-example.html#x1127">menu/menu.cpp</a>, <a href="progress-example.html#x842">progress/progress.cpp</a> and <a href="showimg-example.html#x431">showimg/showimg.cpp</a>.
<h3 class=fn>void <a name="setSeparator"></a>QMenuBar::setSeparator ( <a href="qmenubar.html#Separator-enum">Separator</a>&nbsp;when )<tt> [virtual]</tt>
</h3><p>Sets in which cases a menubar sparator is drawn to <em>when</em>.
See the <a href="qmenubar.html#separator-prop">"separator"</a> property for details.
<h3 class=fn>void <a name="show"></a>QMenuBar::show ()<tt> [virtual]</tt>
</h3>
Reimplements <a href="qwidget.html#show">QWidget::show</a>() in order to set up the correct keyboard
accelerators and to raise itself to the top of the widget stack.

<p>Example: <a href="grapher-nsplugin-example.html#x2598">grapher/grapher.cpp</a>.
<p>Reimplemented from <a href="qwidget.html#show">QWidget</a>.
<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="defaultUp-prop"></a>defaultUp</h3>
<p>This property holds the popup orientation.
<p>The default popup orientation. By default, menus pop "down" the
screen.  By setting the property to TRUE, the menu will pop "up".  You
might call this for menus that are <em>below</em> the document to which
they refer.
<p> If the menu would not fit on the screen, the other direction is used
rather than the default.

<p>Set this property's value with <a href="#setDefaultUp">setDefaultUp</a>() and get this property's value with <a href="#isDefaultUp">isDefaultUp</a>().
<h3 class=fn><a href="qmenubar.html#Separator-enum">Separator</a> <a name="separator-prop"></a>separator</h3>
<p>This property holds in which cases a menubar sparator is drawn.
<p><b>This property is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> 
<p>Set this property's value with <a href="#setSeparator">setSeparator</a>() and get this property's value with <a href="#separator">separator</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>