<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Mac desktop integration and qt_mac_set_menubar_merge( bool )]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">I am currently in the process of "porting" a C++ application to Qt5 and all its amazing amazements. It is a windowless app, with only a QSystemTrayIcon giving information about a simple background process. When built against Qt 4.8.4 the "Quit", "Settings" and "About" menus are shown in the context menu associated with the tray icon. However, when built against Qt 5.0.0, the same menus items simply disappear.<br />
I found that odd but remembered that Qt does some work for you to follow Mac OS X user interface guidelines when it comes to those menu items. As I don't have any windows, I chose not to have a dock icon, and by extension no menu bar. This makes those quite useful menu items simply inaccessible to the user. Bummer...</p>
<p dir="auto">So I looked up the documentation for the method: @qt_mac_set_menubar_merge( bool )@<br />
Although this method is clearly documented, it is nowhere to be found in Qt 5.0.0 (it is available in 4.8.4).</p>
<p dir="auto">I know this symbol is not publicly defined in the Qt headers by default so I defined it myself. With Qt 4.8.4 at link time the symbol is found and I can build the application. The problem with Qt 5.0.0 is that this very same symbol can't be found at link time.<br />
I scanned the latest Qt 5.0.1 source code for it and found that it can only be found in an example "languagechooser.cpp" source code surrounded by the @#ifdef Q_WS_MAC@<br />
guard which has been deprecated in Qt 5, and in the documentation generation files. Second bummer...</p>
<p dir="auto">My understanding is that this method is no longer part of the Qt API as of 5.0.0, however I am stuck with no solution when it comes to solving that issue. Did similar options move to other parts of the API ? If yes where ?</p>
<p dir="auto">Thanks in advance to anybody who can help me with this.</p>
]]></description><link>https://forum.qt.io/topic/24632/mac-desktop-integration-and-qt_mac_set_menubar_merge-bool</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 16:28:53 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/24632.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 Feb 2013 10:13:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mac desktop integration and qt_mac_set_menubar_merge( bool ) on Tue, 09 Jul 2013 08:45:48 GMT]]></title><description><![CDATA[<p dir="auto">Ok, the correct answer is now to set specifically the menuRole rather than QAction::NoRole. For example:</p>
<p dir="auto">@// About<br />
action = menu-&gt;addAction( tr( "About" ), this, SLOT( about() ) );<br />
action-&gt;setMenuRole( QAction::Preferences );@</p>
]]></description><link>https://forum.qt.io/post/175369</link><guid isPermaLink="true">https://forum.qt.io/post/175369</guid><dc:creator><![CDATA[PysCowboy]]></dc:creator><pubDate>Tue, 09 Jul 2013 08:45:48 GMT</pubDate></item><item><title><![CDATA[Reply to Mac desktop integration and qt_mac_set_menubar_merge( bool ) on Tue, 09 Jul 2013 08:32:13 GMT]]></title><description><![CDATA[<p dir="auto">... and the<br />
@setMenuRole( QAction::NoRole )@</p>
<p dir="auto">trick doesn't do the job in my environment (Qt 5.1.0)</p>
]]></description><link>https://forum.qt.io/post/175368</link><guid isPermaLink="true">https://forum.qt.io/post/175368</guid><dc:creator><![CDATA[PysCowboy]]></dc:creator><pubDate>Tue, 09 Jul 2013 08:32:13 GMT</pubDate></item><item><title><![CDATA[Reply to Mac desktop integration and qt_mac_set_menubar_merge( bool ) on Tue, 09 Jul 2013 08:26:03 GMT]]></title><description><![CDATA[<p dir="auto">qt_mac_set_menubar_merge() seems not to be a part of QtMacExtras:</p>
<p dir="auto">@$ cd qtmacextras<br />
$ fgrep qt_mac_set_menubar_merge * -R</p>
<h1>no output@</h1>
]]></description><link>https://forum.qt.io/post/175367</link><guid isPermaLink="true">https://forum.qt.io/post/175367</guid><dc:creator><![CDATA[PysCowboy]]></dc:creator><pubDate>Tue, 09 Jul 2013 08:26:03 GMT</pubDate></item><item><title><![CDATA[Reply to Mac desktop integration and qt_mac_set_menubar_merge( bool ) on Tue, 26 Feb 2013 10:52:07 GMT]]></title><description><![CDATA[<p dir="auto">Well I found a solution to my problem:<br />
@QMenu* menu = new QMenu();</p>
<p dir="auto">// Settings<br />
QAction* action;<br />
action = menu-&gt;addAction( tr( "Settings" ), this, SLOT( settings() ) );<br />
action-&gt;setMenuRole( QAction::NoRole );</p>
<p dir="auto">// About<br />
action = menu-&gt;addAction( tr( "About" ), this, SLOT( about() ) );<br />
action-&gt;setMenuRole( QAction::NoRole );</p>
<p dir="auto">// Quit<br />
action = menu-&gt;addAction( tr( "Quit" ), qApp, SLOT( quit() ) );<br />
action-&gt;setMenuRole( QAction::NoRole );@</p>
<p dir="auto">The @setMenuRole( QAction::NoRole )@ did the trick!</p>
]]></description><link>https://forum.qt.io/post/168484</link><guid isPermaLink="true">https://forum.qt.io/post/168484</guid><dc:creator><![CDATA[rcari]]></dc:creator><pubDate>Tue, 26 Feb 2013 10:52:07 GMT</pubDate></item><item><title><![CDATA[Reply to Mac desktop integration and qt_mac_set_menubar_merge( bool ) on Tue, 26 Feb 2013 10:23:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">IIRC the lib is qtmacextras (there is also one for windows and X11). The platform very specific stuff have been move the *extras libraries (you should find them on gitorious)</p>
<p dir="auto">Hope it helps</p>
]]></description><link>https://forum.qt.io/post/168483</link><guid isPermaLink="true">https://forum.qt.io/post/168483</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 26 Feb 2013 10:23:26 GMT</pubDate></item></channel></rss>