Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 860

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QMenuBar Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QMenuBar Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QMenuBar class provides a horizontal menu bar. <a href="#details">More...</a></p>

<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qmenubar.html#QMenuBar">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#actionAt">actionAt</a></b> (<i>self</i>, QPoint)</li><li><div class="fn" /><b><a href="qmenubar.html#actionEvent">actionEvent</a></b> (<i>self</i>, QActionEvent)</li><li><div class="fn" />QRect <b><a href="qmenubar.html#actionGeometry">actionGeometry</a></b> (<i>self</i>, QAction)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#activeAction">activeAction</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmenubar.html#addAction">addAction</a></b> (<i>self</i>, QAction&#160;<i>action</i>)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#addAction-2">addAction</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#addAction-3">addAction</a></b> (<i>self</i>, QString&#160;<i>text</i>, QObject&#160;<i>receiver</i>, SLOT()SLOT()&#160;<i>member</i>)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#addAction-4">addAction</a></b> (<i>self</i>, QString&#160;<i>text</i>, callable&#160;<i>receiver</i>)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#addMenu">addMenu</a></b> (<i>self</i>, QMenu&#160;<i>menu</i>)</li><li><div class="fn" />QMenu <b><a href="qmenubar.html#addMenu-2">addMenu</a></b> (<i>self</i>, QString&#160;<i>title</i>)</li><li><div class="fn" />QMenu <b><a href="qmenubar.html#addMenu-3">addMenu</a></b> (<i>self</i>, QIcon&#160;<i>icon</i>, QString&#160;<i>title</i>)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#addSeparator">addSeparator</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmenubar.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qmenubar.html#cornerWidget">cornerWidget</a></b> (<i>self</i>, Qt.Corner&#160;<i>corner</i>&#160;=&#160;Qt.TopRightCorner)</li><li><div class="fn" />bool <b><a href="qmenubar.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />bool <b><a href="qmenubar.html#eventFilter">eventFilter</a></b> (<i>self</i>, QObject, QEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent)</li><li><div class="fn" />int <b><a href="qmenubar.html#heightForWidth">heightForWidth</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qmenubar.html#initStyleOption">initStyleOption</a></b> (<i>self</i>, QStyleOptionMenuItem&#160;<i>option</i>, QAction&#160;<i>action</i>)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#insertMenu">insertMenu</a></b> (<i>self</i>, QAction&#160;<i>before</i>, QMenu&#160;<i>menu</i>)</li><li><div class="fn" />QAction <b><a href="qmenubar.html#insertSeparator">insertSeparator</a></b> (<i>self</i>, QAction&#160;<i>before</i>)</li><li><div class="fn" />bool <b><a href="qmenubar.html#isDefaultUp">isDefaultUp</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmenubar.html#isNativeMenuBar">isNativeMenuBar</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmenubar.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#leaveEvent">leaveEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QSize <b><a href="qmenubar.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmenubar.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qmenubar.html#setActiveAction">setActiveAction</a></b> (<i>self</i>, QAction&#160;<i>action</i>)</li><li><div class="fn" /><b><a href="qmenubar.html#setCornerWidget">setCornerWidget</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>, Qt.Corner&#160;<i>corner</i>&#160;=&#160;Qt.TopRightCorner)</li><li><div class="fn" /><b><a href="qmenubar.html#setDefaultUp">setDefaultUp</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qmenubar.html#setNativeMenuBar">setNativeMenuBar</a></b> (<i>self</i>, bool&#160;<i>nativeMenuBar</i>)</li><li><div class="fn" /><b><a href="qmenubar.html#setVisible">setVisible</a></b> (<i>self</i>, bool&#160;<i>visible</i>)</li><li><div class="fn" />QSize <b><a href="qmenubar.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmenubar.html#timerEvent">timerEvent</a></b> (<i>self</i>, QTimerEvent)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qmenubar.html#hovered">hovered</a></b> (QAction *)</li><li><div class="fn" />void <b><a href="qmenubar.html#triggered">triggered</a></b> (QAction *)</li></ul><a name="details" /><hr /><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 "&amp;&amp;" 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 id="usage" name="usage" />
<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">"&amp;File"</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 id="platform-dependent-look-and-feel" name="platform-dependent-look-and-feel" />
<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 class="odd" valign="top">
<td><img alt="A menu bar shown in the" src="images/plastique-menubar.png" /> 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 class="even" valign="top">
<td><img alt="A menu bar shown in the" src="images/motif-menubar.png" /> 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 id="qmenubar-on-mac-os-x" name="qmenubar-on-mac-os-x" />
<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 "QMenuBar" 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 class="odd" valign="top">
<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 class="even" valign="top">
<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 class="odd" valign="top">
<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 id="qmenubar-on-windows-ce" name="qmenubar-on-windows-ce" />
<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 id="examples" name="examples" />
<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>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QMenuBar" />QMenuBar.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a menu bar with parent <i>parent</i>.</p>


<h3 class="fn"><a name="actionAt" /><a href="qaction.html">QAction</a> QMenuBar.actionAt (<i>self</i>, <a href="qpoint.html">QPoint</a>)</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>


<h3 class="fn"><a name="actionEvent" />QMenuBar.actionEvent (<i>self</i>, <a href="qactionevent.html">QActionEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#actionEvent">QWidget.actionEvent</a>().</p>


<h3 class="fn"><a name="actionGeometry" /><a href="qrect.html">QRect</a> QMenuBar.actionGeometry (<i>self</i>, <a href="qaction.html">QAction</a>)</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>


<h3 class="fn"><a name="activeAction" /><a href="qaction.html">QAction</a> QMenuBar.activeAction (<i>self</i>)</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>


<h3 class="fn"><a name="addAction" />QMenuBar.addAction (<i>self</i>, <a href="qaction.html">QAction</a>&#160;<i>action</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>


<h3 class="fn"><a name="addAction-2" /><a href="qaction.html">QAction</a> QMenuBar.addAction (<i>self</i>, QString&#160;<i>text</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>


<h3 class="fn"><a name="addAction-3" /><a href="qaction.html">QAction</a> QMenuBar.addAction (<i>self</i>, QString&#160;<i>text</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()SLOT()&#160;<i>member</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>


<h3 class="fn"><a name="addAction-4" /><a href="qaction.html">QAction</a> QMenuBar.addAction (<i>self</i>, QString&#160;<i>text</i>, callable&#160;<i>receiver</i>)</h3><h3 class="fn"><a name="addMenu" /><a href="qaction.html">QAction</a> QMenuBar.addMenu (<i>self</i>, <a href="qmenu.html">QMenu</a>&#160;<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>


<h3 class="fn"><a name="addMenu-2" /><a href="qmenu.html">QMenu</a> QMenuBar.addMenu (<i>self</i>, QString&#160;<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>


<h3 class="fn"><a name="addMenu-3" /><a href="qmenu.html">QMenu</a> QMenuBar.addMenu (<i>self</i>, <a href="qicon.html">QIcon</a>&#160;<i>icon</i>, QString&#160;<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>


<h3 class="fn"><a name="addSeparator" /><a href="qaction.html">QAction</a> QMenuBar.addSeparator (<i>self</i>)</h3><p>Appends a separator to the menu.</p>


<h3 class="fn"><a name="changeEvent" />QMenuBar.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>


<h3 class="fn"><a name="clear" />QMenuBar.clear (<i>self</i>)</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>


<h3 class="fn"><a name="cornerWidget" /><a href="qwidget.html">QWidget</a> QMenuBar.cornerWidget (<i>self</i>, <a href="qt.html#Corner-enum">Qt.Corner</a>&#160;<i>corner</i>&#160;=&#160;Qt.TopRightCorner)</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>


<h3 class="fn"><a name="event" />bool QMenuBar.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="eventFilter" />bool QMenuBar.eventFilter (<i>self</i>, <a href="qobject.html">QObject</a>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#eventFilter">QObject.eventFilter</a>().</p>


<h3 class="fn"><a name="focusInEvent" />QMenuBar.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget.focusInEvent</a>().</p>


<h3 class="fn"><a name="focusOutEvent" />QMenuBar.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget.focusOutEvent</a>().</p>


<h3 class="fn"><a name="heightForWidth" />int QMenuBar.heightForWidth (<i>self</i>, int)</h3><p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget.heightForWidth</a>().</p>


<h3 class="fn"><a name="initStyleOption" />QMenuBar.initStyleOption (<i>self</i>, <a href="qstyleoptionmenuitem.html">QStyleOptionMenuItem</a>&#160;<i>option</i>, <a href="qaction.html">QAction</a>&#160;<i>action</i>)</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>


<h3 class="fn"><a name="insertMenu" /><a href="qaction.html">QAction</a> QMenuBar.insertMenu (<i>self</i>, <a href="qaction.html">QAction</a>&#160;<i>before</i>, <a href="qmenu.html">QMenu</a>&#160;<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>


<h3 class="fn"><a name="insertSeparator" /><a href="qaction.html">QAction</a> QMenuBar.insertSeparator (<i>self</i>, <a href="qaction.html">QAction</a>&#160;<i>before</i>)</h3><p>This convenience function creates a new separator action, i.e.
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>


<h3 class="fn"><a name="isDefaultUp" />bool QMenuBar.isDefaultUp (<i>self</i>)</h3><h3 class="fn"><a name="isNativeMenuBar" />bool QMenuBar.isNativeMenuBar (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QMenuBar.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>


<h3 class="fn"><a name="leaveEvent" />QMenuBar.leaveEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#leaveEvent">QWidget.leaveEvent</a>().</p>


<h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QMenuBar.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p>


<h3 class="fn"><a name="mouseMoveEvent" />QMenuBar.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>


<h3 class="fn"><a name="mousePressEvent" />QMenuBar.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p>


<h3 class="fn"><a name="mouseReleaseEvent" />QMenuBar.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p>


<h3 class="fn"><a name="paintEvent" />QMenuBar.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>


<h3 class="fn"><a name="resizeEvent" />QMenuBar.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>


<h3 class="fn"><a name="setActiveAction" />QMenuBar.setActiveAction (<i>self</i>, <a href="qaction.html">QAction</a>&#160;<i>action</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>


<h3 class="fn"><a name="setCornerWidget" />QMenuBar.setCornerWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#Corner-enum">Qt.Corner</a>&#160;<i>corner</i>&#160;=&#160;Qt.TopRightCorner)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><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>


<h3 class="fn"><a name="setDefaultUp" />QMenuBar.setDefaultUp (<i>self</i>, bool)</h3><h3 class="fn"><a name="setNativeMenuBar" />QMenuBar.setNativeMenuBar (<i>self</i>, bool&#160;<i>nativeMenuBar</i>)</h3><h3 class="fn"><a name="setVisible" />QMenuBar.setVisible (<i>self</i>, bool&#160;<i>visible</i>)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QMenuBar.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>


<h3 class="fn"><a name="timerEvent" />QMenuBar.timerEvent (<i>self</i>, <a href="qtimerevent.html">QTimerEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#timerEvent">QObject.timerEvent</a>().</p>


<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="hovered" />void hovered (QAction *)</h3><p>This is the default overload of this signal.</p><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>


<h3 class="fn"><a name="triggered" />void triggered (QAction *)</h3><p>This is the default overload of this signal.</p><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>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>