Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 3442

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qmenubar.cpp -->
  <title>QMenuBar Class | Qt Widgets 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QMenuBar</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#usage">Usage</a></li>
<li class="level2"><a href="#platform-dependent-look-and-feel">Platform Dependent Look and Feel</a></li>
<li class="level2"><a href="#qmenubar-as-a-global-menu-bar">QMenuBar as a Global Menu Bar</a></li>
<li class="level2"><a href="#examples">Examples</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QMenuBar Class</h1>
<!-- $$$QMenuBar-brief -->
<p>The <a href="qmenubar.html">QMenuBar</a> class provides a horizontal menu bar. <a href="#details">More...</a></p>
<!-- @@@QMenuBar -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QMenuBar&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qwidget.html">QWidget</a></td></tr></table></div><ul>
<li><a href="qmenubar-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="qmenubar.html#defaultUp-prop">defaultUp</a></b> : bool</li>
<li class="fn"><b><a href="qmenubar.html#nativeMenuBar-prop">nativeMenuBar</a></b> : bool</li>
</ul>
<ul>
<li class="fn">59 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#QMenuBar">QMenuBar</a></b>(QWidget *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#dtor.QMenuBar">~QMenuBar</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#actionAt">actionAt</a></b>(const QPoint &amp;<i>pt</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#actionGeometry">actionGeometry</a></b>(QAction *<i>act</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#activeAction">activeAction</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addAction">addAction</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addAction-1">addAction</a></b>(const QString &amp;<i>text</i>, const QObject *<i>receiver</i>, const char *<i>member</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addMenu">addMenu</a></b>(QMenu *<i>menu</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMenu *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addMenu-1">addMenu</a></b>(const QString &amp;<i>title</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMenu *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addMenu-2">addMenu</a></b>(const QIcon &amp;<i>icon</i>, const QString &amp;<i>title</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#addSeparator">addSeparator</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#clear">clear</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#cornerWidget">cornerWidget</a></b>(Qt::Corner <i>corner</i> = Qt::TopRightCorner) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#insertMenu">insertMenu</a></b>(QAction *<i>before</i>, QMenu *<i>menu</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#insertSeparator">insertSeparator</a></b>(QAction *<i>before</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#defaultUp-prop">isDefaultUp</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#nativeMenuBar-prop">isNativeMenuBar</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#setActiveAction">setActiveAction</a></b>(QAction *<i>act</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#setCornerWidget">setCornerWidget</a></b>(QWidget *<i>widget</i>, Qt::Corner <i>corner</i> = Qt::TopRightCorner)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#defaultUp-prop">setDefaultUp</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#nativeMenuBar-prop">setNativeMenuBar</a></b>(bool <i>nativeMenuBar</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> NSMenu *</td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#toNSMenu">toNSMenu</a></b>()</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#heightForWidth">heightForWidth</a></b>(<i>int</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#minimumSizeHint">minimumSizeHint</a></b>() const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#sizeHint">sizeHint</a></b>() const override</td></tr>
</table></div>
<ul>
<li class="fn">214 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
<li class="fn">14 public functions inherited from <a href="../qtgui/qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#setVisible">setVisible</a></b>(bool <i>visible</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#hovered">hovered</a></b>(QAction *<i>action</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#triggered">triggered</a></b>(QAction *<i>action</i>)</td></tr>
</table></div>
<ul>
<li class="fn">3 signals inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#initStyleOption">initStyleOption</a></b>(QStyleOptionMenuItem *<i>option</i>, const QAction *<i>action</i>) const</td></tr>
</table></div>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#actionEvent">actionEvent</a></b>(QActionEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#changeEvent">changeEvent</a></b>(QEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#event">event</a></b>(QEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#eventFilter">eventFilter</a></b>(QObject *<i>object</i>, QEvent *<i>event</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#focusInEvent">focusInEvent</a></b>(<i>QFocusEvent *</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#focusOutEvent">focusOutEvent</a></b>(<i>QFocusEvent *</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#keyPressEvent">keyPressEvent</a></b>(QKeyEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#leaveEvent">leaveEvent</a></b>(<i>QEvent *</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#mouseMoveEvent">mouseMoveEvent</a></b>(QMouseEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#mousePressEvent">mousePressEvent</a></b>(QMouseEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#mouseReleaseEvent">mouseReleaseEvent</a></b>(QMouseEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#paintEvent">paintEvent</a></b>(QPaintEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#resizeEvent">resizeEvent</a></b>(<i>QResizeEvent *</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmenubar.html#timerEvent">timerEvent</a></b>(QTimerEvent *<i>e</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">35 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">5 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
<li class="fn">1 protected type inherited from <a href="../qtgui/qpaintdevice.html#protected-variables">QPaintDevice</a></li>
</ul>
<a name="details"></a>
<!-- $$$QMenuBar-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qmenubar.html">QMenuBar</a> 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 <code>menubar</code> is a pointer to a <a href="qmenubar.html">QMenuBar</a> and <code>fileMenu</code> 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>addMenu(fileMenu);

</pre>
<p>The ampersand in the menu item's text sets Alt+F as a shortcut for this menu. (You can use &quot;&amp;&amp;&quot; to get a real ampersand in the menu bar.)</p>
<p>There is no need to lay out a menu bar. It automatically sets its own geometry to the top of the parent widget and changes it appropriately whenever the parent is resized.</p>
<a name="usage"></a>
<h3 >Usage</h3>
<p>In most main window style applications you would use the <a href="qmainwindow.html#menuBar">menuBar()</a> function provided in <a href="qmainwindow.html">QMainWindow</a>, adding <a href="qmenu.html">QMenu</a>s to the menu bar and adding <a href="qaction.html">QAction</a>s to the pop-up menus.</p>
<p>Example (from the <a href="qtwidgets-mainwindows-menus-example.html">Menus</a> example):</p>
<pre class="cpp">

      fileMenu <span class="operator">=</span> menuBar()<span class="operator">-</span><span class="operator">&gt;</span>addMenu(tr(<span class="string">&quot;&amp;File&quot;</span>));
      fileMenu<span class="operator">-</span><span class="operator">&gt;</span>addAction(newAct);

</pre>
<p>Menu items may be removed with <a href="qwidget.html#removeAction">removeAction</a>().</p>
<p>Widgets can be added to menus by using instances of the <a href="qwidgetaction.html">QWidgetAction</a> class to hold them. These actions can then be inserted into menus in the usual way; see the <a href="qmenu.html">QMenu</a> documentation for more details.</p>
<a name="platform-dependent-look-and-feel"></a>
<h3 >Platform Dependent Look and Feel</h3>
<p>Different platforms have different requirements for the appearance of menu bars and their behavior when the user interacts with them. For example, Windows systems are often configured so that the underlined character mnemonics that indicate keyboard shortcuts for items in the menu bar are only shown when the <b>Alt</b> key is pressed.</p>
<a name="qmenubar-as-a-global-menu-bar"></a>
<h3 >QMenuBar as a Global Menu Bar</h3>
<p>On macOS and on certain Linux desktop environments such as Ubuntu Unity, <a href="qmenubar.html">QMenuBar</a> 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="../qtcore/qt.html#WindowType-enum">Qt::Window</a>) will be used for the system-wide menu bar.</p>
<p>Qt for macOS also provides a menu bar merging feature to make <a href="qmenubar.html">QMenuBar</a> conform more closely to accepted macOS 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="../qtcore/qobject.html#tr">QObject::tr</a>()) in the &quot;<a href="qmenubar.html">QMenuBar</a>&quot; context. If an entry is moved its slots will still fire as if it was in the original place. The table below outlines the strings looked for and where the entry is placed if matched:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >String matches</th><th >Placement</th><th >Notes</th></tr></thead>
<tr valign="top" class="odd"><td >about.*</td><td >Application Menu | About &lt;application name&gt;</td><td >The application name is fetched from the <code>Info.plist</code> file (see note below). If this entry is not found no About item will appear in the Application Menu.</td></tr>
<tr valign="top" class="even"><td >config, options, setup, settings or preferences</td><td >Application Menu | Preferences</td><td >If this entry is not found the Settings item will be disabled</td></tr>
<tr valign="top" class="odd"><td >quit or exit</td><td >Application Menu | Quit &lt;application name&gt;</td><td >If this entry is not found a default Quit item will be created to call <a href="../qtcore/qcoreapplication.html#quit">QCoreApplication::quit</a>()</td></tr>
</table></div>
<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"><a href="qmenubar.html#QMenuBar">QMenuBar</a></span> <span class="operator">*</span>menuBar <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qmenubar.html#QMenuBar">QMenuBar</a></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 macOS menu bar is obtained from the value set in the <code>Info.plist</code> file in the application's bundle. See Qt for macOS - Deployment for more information.</p>
<p><b>Note:</b> On Linux, if the com.canonical.AppMenu.Registrar service is available on the D-Bus session bus, then Qt will communicate with it to install the application's menus into the global menu bar, as described.</p>
<a name="examples"></a>
<h3 >Examples</h3>
<p>The <a href="qtwidgets-mainwindows-menus-example.html">Menus</a> example shows how to use <a href="qmenubar.html">QMenuBar</a> and <a href="qmenu.html">QMenu</a>. The other <a href="examples-mainwindow.html">main window application examples</a> also provide menus using these classes.</p>
</div>
<p><b>See also </b><a href="qmenu.html">QMenu</a>, <a href="qshortcut.html">QShortcut</a>, <a href="qaction.html">QAction</a>, <a href="http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/XHIGIntro.html">Introduction to Apple Human Interface Guidelines</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Menu Bar</a>, and <a href="qtwidgets-mainwindows-menus-example.html">Menus Example</a>.</p>
<!-- @@@QMenuBar -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$defaultUp-prop$$$isDefaultUp$$$setDefaultUpbool -->
<h3 class="fn" id="defaultUp-prop"><a name="defaultUp-prop"></a><span class="name">defaultUp</span> : <span class="type">bool</span></h3>
<p>This property holds the popup orientation</p>
<p>The default popup orientation. By default, menus pop &quot;down&quot; the screen. By setting the property to true, the menu will pop &quot;up&quot;. You might call this for menus that are <i>below</i> the document to which they refer.</p>
<p>If the menu would not fit on the screen, the other direction is used automatically.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isDefaultUp</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDefaultUp</b></span>(<i>bool</i>)</td></tr>
</table></div>
<!-- @@@defaultUp -->
<!-- $$$nativeMenuBar-prop$$$isNativeMenuBar$$$setNativeMenuBarbool -->
<h3 class="fn" id="nativeMenuBar-prop"><a name="nativeMenuBar-prop"></a><span class="name">nativeMenuBar</span> : <span class="type">bool</span></h3>
<p>This property holds whether or not a menubar will be used as a native menubar on platforms that support it</p>
<p>This property specifies whether or not the menubar should be used as a native menubar on platforms that support it. The currently supported platforms are macOS, and Linux desktops which use the com.canonical.dbusmenu D-Bus interface (such as Ubuntu Unity). If this property is <code>true</code>, the menubar is used in the native menubar and is not in the window of its parent; if <code>false</code> the menubar remains in the window. On other platforms, setting this attribute has no effect, and reading this attribute will always return <code>false</code>.</p>
<p>The default is to follow whether the <a href="../qtcore/qt.html#ApplicationAttribute-enum">Qt::AA_DontUseNativeMenuBar</a> attribute is set for the application. Explicitly setting this property overrides the presence (or absence) of the attribute.</p>
<p>This property was introduced in  Qt 4.6.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isNativeMenuBar</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setNativeMenuBar</b></span>(bool <i>nativeMenuBar</i>)</td></tr>
</table></div>
<!-- @@@nativeMenuBar -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QMenuBar[overload1]$$$QMenuBarQWidget* -->
<h3 class="fn" id="QMenuBar"><a name="QMenuBar"></a>QMenuBar::<span class="name">QMenuBar</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a menu bar with parent <i>parent</i>.</p>
<!-- @@@QMenuBar -->
<!-- $$$~QMenuBar[overload1]$$$~QMenuBar -->
<h3 class="fn" id="dtor.QMenuBar"><a name="dtor.QMenuBar"></a>QMenuBar::<span class="name">~QMenuBar</span>()</h3>
<p>Destroys the menu bar.</p>
<!-- @@@~QMenuBar -->
<!-- $$$actionAt[overload1]$$$actionAtconstQPoint& -->
<h3 class="fn" id="actionAt"><a name="actionAt"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">actionAt</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>pt</i>) const</h3>
<p>Returns the <a href="qaction.html">QAction</a> at <i>pt</i>. Returns 0 if there is no action at <i>pt</i> or if the location has a separator.</p>
<p><b>See also </b><a href="qmenubar.html#addAction">addAction</a>() and <a href="qmenubar.html#addSeparator">addSeparator</a>().</p>
<!-- @@@actionAt -->
<!-- $$$actionEvent[overload1]$$$actionEventQActionEvent* -->
<h3 class="fn" id="actionEvent"><a name="actionEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">actionEvent</span>(<span class="type"><a href="../qtgui/qactionevent.html">QActionEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#actionEvent">QWidget::actionEvent</a>().</p>
<!-- @@@actionEvent -->
<!-- $$$actionGeometry[overload1]$$$actionGeometryQAction* -->
<h3 class="fn" id="actionGeometry"><a name="actionGeometry"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QMenuBar::<span class="name">actionGeometry</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>act</i>) const</h3>
<p>Returns the geometry of action <i>act</i> as a <a href="../qtcore/qrect.html">QRect</a>.</p>
<p><b>See also </b><a href="qmenubar.html#actionAt">actionAt</a>().</p>
<!-- @@@actionGeometry -->
<!-- $$$activeAction[overload1]$$$activeAction -->
<h3 class="fn" id="activeAction"><a name="activeAction"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">activeAction</span>() const</h3>
<p>Returns the <a href="qaction.html">QAction</a> that is currently highlighted. A null pointer will be returned if no action is currently selected.</p>
<p><b>See also </b><a href="qmenubar.html#setActiveAction">setActiveAction</a>().</p>
<!-- @@@activeAction -->
<!-- $$$addAction[overload1]$$$addActionconstQString& -->
<h3 class="fn" id="addAction"><a name="addAction"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">addAction</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>This is an overloaded function.</p>
<p>This convenience function creates a new action with <i>text</i>. The function adds the newly created action to the menu's list of actions, and returns it.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qwidget.html#actions">QWidget::actions</a>().</p>
<!-- @@@addAction -->
<!-- $$$addAction$$$addActionconstQString&constQObject*constchar* -->
<h3 class="fn" id="addAction-1"><a name="addAction-1"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">addAction</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, const <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>receiver</i>, const <span class="type">char</span> *<i>member</i>)</h3>
<p>This is an overloaded function.</p>
<p>This convenience function creates a new action with the given <i>text</i>. The action's <a href="qmenubar.html#triggered">triggered</a>() signal is connected to the <i>receiver</i>'s <i>member</i> slot. The function adds the newly created action to the menu's list of actions and returns it.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qwidget.html#actions">QWidget::actions</a>().</p>
<!-- @@@addAction -->
<!-- $$$addMenu[overload1]$$$addMenuQMenu* -->
<h3 class="fn" id="addMenu"><a name="addMenu"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">addMenu</span>(<span class="type"><a href="qmenu.html">QMenu</a></span> *<i>menu</i>)</h3>
<p>Appends <i>menu</i> to the menu bar. Returns the menu's menuAction().</p>
<p><b>Note: </b>The returned <a href="qaction.html">QAction</a> object can be used to hide the corresponding menu.</p><p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qmenu.html#menuAction">QMenu::menuAction</a>().</p>
<!-- @@@addMenu -->
<!-- $$$addMenu$$$addMenuconstQString& -->
<h3 class="fn" id="addMenu-1"><a name="addMenu-1"></a><span class="type"><a href="qmenu.html">QMenu</a></span> *QMenuBar::<span class="name">addMenu</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>)</h3>
<p>Appends a new <a href="qmenu.html">QMenu</a> with <i>title</i> to the menu bar. The menu bar takes ownership of the menu. Returns the new menu.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qmenu.html#menuAction">QMenu::menuAction</a>().</p>
<!-- @@@addMenu -->
<!-- $$$addMenu$$$addMenuconstQIcon&constQString& -->
<h3 class="fn" id="addMenu-2"><a name="addMenu-2"></a><span class="type"><a href="qmenu.html">QMenu</a></span> *QMenuBar::<span class="name">addMenu</span>(const <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> &amp;<i>icon</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>)</h3>
<p>Appends a new <a href="qmenu.html">QMenu</a> with <i>icon</i> and <i>title</i> to the menu bar. The menu bar takes ownership of the menu. Returns the new menu.</p>
<p><b>See also </b><a href="qwidget.html#addAction">QWidget::addAction</a>() and <a href="qmenu.html#menuAction">QMenu::menuAction</a>().</p>
<!-- @@@addMenu -->
<!-- $$$addSeparator[overload1]$$$addSeparator -->
<h3 class="fn" id="addSeparator"><a name="addSeparator"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">addSeparator</span>()</h3>
<p>Appends a separator to the menu.</p>
<!-- @@@addSeparator -->
<!-- $$$changeEvent[overload1]$$$changeEventQEvent* -->
<h3 class="fn" id="changeEvent"><a name="changeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">changeEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget::changeEvent</a>().</p>
<!-- @@@changeEvent -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn" id="clear"><a name="clear"></a><span class="type">void</span> QMenuBar::<span class="name">clear</span>()</h3>
<p>Removes all the actions from the menu bar.</p>
<p><b>Note: </b>On macOS, menu items that have been merged to the system menu bar are not removed by this function. One way to handle this would be to remove the extra actions yourself. You can set the <a href="qaction.html#MenuRole-enum">menu role</a> on the different menus, so that you know ahead of time which menu items get merged and which do not. Then decide what to recreate or remove yourself.</p><p><b>See also </b><a href="qwidget.html#removeAction">removeAction</a>().</p>
<!-- @@@clear -->
<!-- $$$cornerWidget[overload1]$$$cornerWidgetQt::Corner -->
<h3 class="fn" id="cornerWidget"><a name="cornerWidget"></a><span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *QMenuBar::<span class="name">cornerWidget</span>(<span class="type"><a href="../qtcore/qt.html#Corner-enum">Qt::Corner</a></span> <i>corner</i> = Qt::TopRightCorner) const</h3>
<p>Returns the widget on the left of the first or on the right of the last menu item, depending on <i>corner</i>.</p>
<p><b>Note: </b>Using a corner other than <a href="../qtcore/qt.html#Corner-enum">Qt::TopRightCorner</a> or <a href="../qtcore/qt.html#Corner-enum">Qt::TopLeftCorner</a> will result in a warning.</p><p><b>See also </b><a href="qmenubar.html#setCornerWidget">setCornerWidget</a>().</p>
<!-- @@@cornerWidget -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn" id="event"><a name="event"></a><code>[override virtual protected] </code><span class="type">bool</span> QMenuBar::<span class="name">event</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$eventFilter[overload1]$$$eventFilterQObject*QEvent* -->
<h3 class="fn" id="eventFilter"><a name="eventFilter"></a><code>[override virtual protected] </code><span class="type">bool</span> QMenuBar::<span class="name">eventFilter</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>object</i>, <span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qobject.html#eventFilter">QObject::eventFilter</a>().</p>
<!-- @@@eventFilter -->
<!-- $$$focusInEvent[overload1]$$$focusInEventQFocusEvent* -->
<h3 class="fn" id="focusInEvent"><a name="focusInEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">focusInEvent</span>(<i>QFocusEvent *</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget::focusInEvent</a>().</p>
<!-- @@@focusInEvent -->
<!-- $$$focusOutEvent[overload1]$$$focusOutEventQFocusEvent* -->
<h3 class="fn" id="focusOutEvent"><a name="focusOutEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">focusOutEvent</span>(<i>QFocusEvent *</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget::focusOutEvent</a>().</p>
<!-- @@@focusOutEvent -->
<!-- $$$heightForWidth[overload1]$$$heightForWidthint -->
<h3 class="fn" id="heightForWidth"><a name="heightForWidth"></a><code>[override virtual] </code><span class="type">int</span> QMenuBar::<span class="name">heightForWidth</span>(<i>int</i>) const</h3>
<p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget::heightForWidth</a>().</p>
<!-- @@@heightForWidth -->
<!-- $$$hovered[overload1]$$$hoveredQAction* -->
<h3 class="fn" id="hovered"><a name="hovered"></a><code>[signal] </code><span class="type">void</span> QMenuBar::<span class="name">hovered</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>action</i>)</h3>
<p>This signal is emitted when a menu action is highlighted; <i>action</i> is the action that caused the event to be sent.</p>
<p>Often this is used to update status information.</p>
<p><b>See also </b><a href="qmenubar.html#triggered">triggered</a>() and <a href="qaction.html#hovered">QAction::hovered</a>().</p>
<!-- @@@hovered -->
<!-- $$$initStyleOption[overload1]$$$initStyleOptionQStyleOptionMenuItem*constQAction* -->
<h3 class="fn" id="initStyleOption"><a name="initStyleOption"></a><code>[protected] </code><span class="type">void</span> QMenuBar::<span class="name">initStyleOption</span>(<span class="type"><a href="qstyleoptionmenuitem.html">QStyleOptionMenuItem</a></span> *<i>option</i>, const <span class="type"><a href="qaction.html">QAction</a></span> *<i>action</i>) const</h3>
<p>Initialize <i>option</i> with the values from the menu bar and information from <i>action</i>. This method is useful for subclasses when they need a <a href="qstyleoptionmenuitem.html">QStyleOptionMenuItem</a>, but don't want to fill in all the information themselves.</p>
<p><b>See also </b><a href="qstyleoption.html#initFrom">QStyleOption::initFrom</a>() and <a href="qmenu.html#initStyleOption">QMenu::initStyleOption</a>().</p>
<!-- @@@initStyleOption -->
<!-- $$$insertMenu[overload1]$$$insertMenuQAction*QMenu* -->
<h3 class="fn" id="insertMenu"><a name="insertMenu"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">insertMenu</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>before</i>, <span class="type"><a href="qmenu.html">QMenu</a></span> *<i>menu</i>)</h3>
<p>This convenience function inserts <i>menu</i> before action <i>before</i> and returns the menus menuAction().</p>
<p><b>See also </b><a href="qwidget.html#insertAction">QWidget::insertAction</a>() and <a href="qmenubar.html#addMenu">addMenu</a>().</p>
<!-- @@@insertMenu -->
<!-- $$$insertSeparator[overload1]$$$insertSeparatorQAction* -->
<h3 class="fn" id="insertSeparator"><a name="insertSeparator"></a><span class="type"><a href="qaction.html">QAction</a></span> *QMenuBar::<span class="name">insertSeparator</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>before</i>)</h3>
<p>This convenience function creates a new separator action, i.e&#x2e; an action with <a href="qaction.html#isSeparator">QAction::isSeparator</a>() returning true. The function inserts the newly created action into this menu bar's list of actions before action <i>before</i> and returns it.</p>
<p><b>See also </b><a href="qwidget.html#insertAction">QWidget::insertAction</a>() and <a href="qmenubar.html#addSeparator">addSeparator</a>().</p>
<!-- @@@insertSeparator -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn" id="keyPressEvent"><a name="keyPressEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">keyPressEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>().</p>
<!-- @@@keyPressEvent -->
<!-- $$$leaveEvent[overload1]$$$leaveEventQEvent* -->
<h3 class="fn" id="leaveEvent"><a name="leaveEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">leaveEvent</span>(<i>QEvent *</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#leaveEvent">QWidget::leaveEvent</a>().</p>
<!-- @@@leaveEvent -->
<!-- $$$minimumSizeHint[overload1]$$$minimumSizeHint -->
<h3 class="fn" id="minimumSizeHint"><a name="minimumSizeHint"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QMenuBar::<span class="name">minimumSizeHint</span>() const</h3>
<p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget::minimumSizeHint</a>().</p>
<!-- @@@minimumSizeHint -->
<!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQMouseEvent* -->
<h3 class="fn" id="mouseMoveEvent"><a name="mouseMoveEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">mouseMoveEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>().</p>
<!-- @@@mouseMoveEvent -->
<!-- $$$mousePressEvent[overload1]$$$mousePressEventQMouseEvent* -->
<h3 class="fn" id="mousePressEvent"><a name="mousePressEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">mousePressEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>().</p>
<!-- @@@mousePressEvent -->
<!-- $$$mouseReleaseEvent[overload1]$$$mouseReleaseEventQMouseEvent* -->
<h3 class="fn" id="mouseReleaseEvent"><a name="mouseReleaseEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">mouseReleaseEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>().</p>
<!-- @@@mouseReleaseEvent -->
<!-- $$$paintEvent[overload1]$$$paintEventQPaintEvent* -->
<h3 class="fn" id="paintEvent"><a name="paintEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">paintEvent</span>(<span class="type"><a href="../qtgui/qpaintevent.html">QPaintEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>().</p>
<!-- @@@paintEvent -->
<!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* -->
<h3 class="fn" id="resizeEvent"><a name="resizeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">resizeEvent</span>(<i>QResizeEvent *</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget::resizeEvent</a>().</p>
<!-- @@@resizeEvent -->
<!-- $$$setActiveAction[overload1]$$$setActiveActionQAction* -->
<h3 class="fn" id="setActiveAction"><a name="setActiveAction"></a><span class="type">void</span> QMenuBar::<span class="name">setActiveAction</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>act</i>)</h3>
<p>Sets the currently highlighted action to <i>act</i>.</p>
<p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qmenubar.html#activeAction">activeAction</a>().</p>
<!-- @@@setActiveAction -->
<!-- $$$setCornerWidget[overload1]$$$setCornerWidgetQWidget*Qt::Corner -->
<h3 class="fn" id="setCornerWidget"><a name="setCornerWidget"></a><span class="type">void</span> QMenuBar::<span class="name">setCornerWidget</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>, <span class="type"><a href="../qtcore/qt.html#Corner-enum">Qt::Corner</a></span> <i>corner</i> = Qt::TopRightCorner)</h3>
<p>This sets the given <i>widget</i> to be shown directly on the left of the first menu item, or on the right of the last menu item, depending on <i>corner</i>.</p>
<p>The menu bar takes ownership of <i>widget</i>, reparenting it into the menu bar. However, if the <i>corner</i> already contains a widget, this previous widget will no longer be managed and will still be a visible child of the menu bar.</p>
<p><b>Note: </b>Using a corner other than <a href="../qtcore/qt.html#Corner-enum">Qt::TopRightCorner</a> or <a href="../qtcore/qt.html#Corner-enum">Qt::TopLeftCorner</a> will result in a warning.</p><p><b>See also </b><a href="qmenubar.html#cornerWidget">cornerWidget</a>().</p>
<!-- @@@setCornerWidget -->
<!-- $$$setVisible[overload1]$$$setVisiblebool -->
<h3 class="fn" id="setVisible"><a name="setVisible"></a><code>[override virtual slot] </code><span class="type">void</span> QMenuBar::<span class="name">setVisible</span>(<span class="type">bool</span> <i>visible</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget::setVisible</a>().</p>
<!-- @@@setVisible -->
<!-- $$$sizeHint[overload1]$$$sizeHint -->
<h3 class="fn" id="sizeHint"><a name="sizeHint"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QMenuBar::<span class="name">sizeHint</span>() const</h3>
<p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>().</p>
<!-- @@@sizeHint -->
<!-- $$$timerEvent[overload1]$$$timerEventQTimerEvent* -->
<h3 class="fn" id="timerEvent"><a name="timerEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMenuBar::<span class="name">timerEvent</span>(<span class="type"><a href="../qtcore/qtimerevent.html">QTimerEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qobject.html#timerEvent">QObject::timerEvent</a>().</p>
<!-- @@@timerEvent -->
<!-- $$$toNSMenu[overload1]$$$toNSMenu -->
<h3 class="fn" id="toNSMenu"><a name="toNSMenu"></a><span class="type">NSMenu</span> *QMenuBar::<span class="name">toNSMenu</span>()</h3>
<p>Returns the native NSMenu for this menu bar. Available on macOS only.</p>
<p><b>Note: </b>Qt may set the delegate on the native menu bar. If you need to set your own delegate, make sure you save the original one and forward any calls to it.</p><p>This function was introduced in  Qt 5.2.</p>
<!-- @@@toNSMenu -->
<!-- $$$triggered[overload1]$$$triggeredQAction* -->
<h3 class="fn" id="triggered"><a name="triggered"></a><code>[signal] </code><span class="type">void</span> QMenuBar::<span class="name">triggered</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>action</i>)</h3>
<p>This signal is emitted when an action in a menu belonging to this menubar is triggered as a result of a mouse click; <i>action</i> is the action that caused the signal to be emitted.</p>
<p><b>Note: </b><a href="qmenubar.html">QMenuBar</a> has to have ownership of the <a href="qmenu.html">QMenu</a> in order this signal to work.</p><p>Normally, you connect each menu action to a single slot using <a href="qaction.html#triggered">QAction::triggered</a>(), but sometimes you will want to connect several items to a single slot (most often if the user selects from an array). This signal is useful in such cases.</p>
<p><b>See also </b><a href="qmenubar.html#hovered">hovered</a>() and <a href="qaction.html#triggered">QAction::triggered</a>().</p>
<!-- @@@triggered -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>