<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>TQMenuBar Class Reference</h1>
<p>The TQMenuBar class provides a horizontal menu bar.
<p><ahref="menu-example.html">menu/menu.cpp</a> is an example of
TQMenuBar and <ahref="qpopupmenu.html">TQPopupMenu</a> use.
<p><p>See also <ahref="qpopupmenu.html">TQPopupMenu</a>, <ahref="qaccel.html">TQAccel</a>, <ahref="qaction.html">TQAction</a>, <ahref="http://developer.apple.com/techpubs/macosx/Carbon/HumanInterfaceToolbox/Aqua/aqua.html">Aqua Style Guidelines</a>, <ahref="guibooks.html#fowler">GUI Design Handbook: Menu Bar</a>, and <ahref="application.html">Main Window and Related Classes</a>.
<p> In the example above, pressing Ctrl+O or selecting "Open" from the
menu activates the myView->open() function.
<p> Some insert functions take a <ahref="qiconset.html">TQIconSet</a> parameter to specify the
little menu item icon. Note that you can always pass a <ahref="qpixmap.html">TQPixmap</a>
object instead.
<p> The <em>id</em> specifies the identification number associated with the
menu item. Note that only positive values are valid, as a negative
value will make TQt select a unique id for the item.
<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 TQt are not application-global,
instead they are bound to a certain top-level window. For example,
accelerators in <ahref="qpopupmenu.html">TQPopupMenu</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 <ahref="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 <ahref="qaccel.html">TQAccel</a>
object.
<p><b>Warning:</b> Be careful when passing a literal 0 to <ahref="qmenudata.html#insertItem">insertItem</a>()
because some C++ compilers choose the wrong overloaded function.
Cast the 0 to what you mean, e.g. <tt>(TQObject*)0</tt>.
<p><b>Warning:</b> On Mac OS X, items that connect to a slot that are inserted into a
menubar will not function as we use the native menubar that knows nothing
about signals or slots. Instead insert the items into a popup menu and
insert the popup menu into the menubar. This may be fixed in a future TQt
version.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qaccel.html">TQAccel</a>, and <ahref="qnamespace-h.html">qnamespace.h</a>.
<p>Examples: <ahref="addressbook-example.html#x569">addressbook/mainwindow.cpp</a>, <ahref="canvas-example.html#x2936">canvas/canvas.cpp</a>, <ahref="menu-example.html#x1869">menu/menu.cpp</a>, <ahref="qwerty-example.html#x371">qwerty/qwerty.cpp</a>, <ahref="scrollview-example.html#x634">scrollview/scrollview.cpp</a>, <ahref="showimg-example.html#x1327">showimg/showimg.cpp</a>, and <ahref="sound-example.html#x2810">sound/sound.cpp</a>.
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> position. 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 <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qaccel.html">TQAccel</a>, and <ahref="qnamespace-h.html">qnamespace.h</a>.
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> position. 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 <ahref="qpixmap.html#mask">TQPixmap::mask</a>()).
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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>
position. 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 <ahref="qpixmap.html#mask">TQPixmap::mask</a>()).
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qaccel.html">TQAccel</a>, and <ahref="qnamespace-h.html">qnamespace.h</a>.
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> position.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position. The icon will be displayed
to the left of the text in the item.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position.
<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 <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position. 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 <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position.
<p> To look best when being highlighted as a menu item, the pixmap
should provide a mask (see <ahref="qpixmap.html#mask">TQPixmap::mask</a>()).
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position. The icon will be
displayed to the left of the pixmap in the item.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position.
<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 <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position. 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 <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
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> position.
<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 slot, use <ahref="qmenudata.html#connectItem">connectItem</a>().
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qmenudata.html#removeItem">removeItem</a>(), and <ahref="qcustommenuitem.html">TQCustomMenuItem</a>.
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> position.
<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 slot, use <ahref="qmenudata.html#connectItem">connectItem</a>().
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qmenudata.html#removeItem">removeItem</a>(), and <ahref="qcustommenuitem.html">TQCustomMenuItem</a>.
<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 automatically.
<p>Set this property's value with <ahref="#setDefaultUp">setDefaultUp</a>() and get this property's value with <ahref="#isDefaultUp">isDefaultUp</a>().