<?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[Qt6 on Mac: setIcon on a QAction not working since 6.7.3]]></title><description><![CDATA[<p dir="auto">Hi, The following code works on Windows up to Qt6.9.2 but is broken on Mac since 6.7.3 (6.7.2 was the latest working version), the image "bart.png" (must be in the same directory) isn't shown in addition to the "Hello Bart" text in the contextual popup menu. (Same for menu QAction images if the menu is in the menu bar).</p>
<pre><code>#include &lt;QtGui&gt;
#include &lt;QApplication&gt;
#include &lt;QMenu&gt;
#include &lt;QLineEdit&gt;
#include &lt;QDebug&gt;
#include &lt;QDir&gt;
class WLineEdit : public QLineEdit
{
  public:
  WLineEdit(QWidget *parent) : QLineEdit(parent)
  {
  }
  void contextMenuEvent( QContextMenuEvent * e  )
  {
    QPointer&lt;QMenu&gt; pop = new QMenu( this );
    QPixmap pix=QPixmap("bart.png");
    QAction* ac = pop-&gt;addAction( "Hallo Bart");
    ac-&gt;setIcon(pix);
    pop-&gt;exec(e-&gt;globalPos());
  }
};
int main(int argc, char**argv)
{
  QApplication app(argc, argv);
  qDebug() &lt;&lt; "current path:" &lt;&lt; QDir::currentPath();
  WLineEdit le(0);
  le.show();
  return app.exec();
}
</code></pre>
<p dir="auto">Did someone encounter the same problem ?<br />
Regards , Leo</p>
]]></description><link>https://forum.qt.io/topic/163217/qt6-on-mac-seticon-on-a-qaction-not-working-since-6.7.3</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 00:17:28 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/163217.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Sep 2025 13:37:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt6 on Mac: setIcon on a QAction not working since 6.7.3 on Thu, 11 Sep 2025 16:04:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/leo-schubert">@<bdi>Leo-Schubert</bdi></a> it isn't broken, it is just that since this version <code>Qt::AA_DontShowIconsInMenus</code> application attribute is enabled on default on macOS. You need to disable it yourself if you want them.</p>
<p dir="auto">Under the Big Sur design system, Mac applications customarily don't use icons in menus, so it made sense. They do make a comeback in the "Liquid Glass" design system of the upcoming macOS Tahoe.</p>
]]></description><link>https://forum.qt.io/post/831475</link><guid isPermaLink="true">https://forum.qt.io/post/831475</guid><dc:creator><![CDATA[IgKh]]></dc:creator><pubDate>Thu, 11 Sep 2025 16:04:19 GMT</pubDate></item><item><title><![CDATA[Reply to Qt6 on Mac: setIcon on a QAction not working since 6.7.3 on Thu, 11 Sep 2025 17:14:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/igkh">@<bdi>IgKh</bdi></a> Thanks, I did find the release notes of Qt6.7.3 stating</p>
<p dir="auto">a2aa1f81a81 Determine Qt::AA_DontShowIconsInMenus default value based on platform The default value of Qt::AA_DontShowIconsInMenus is now determined based on the platform. On macOS icons will not show by default. To override, use QAction.iconVisibleInMenu for individual menu actions, or set Qt::AA_DontShowIconsInMenus to false.</p>
<p dir="auto">As it did change from 6.7.2-&gt;6.7.3 my assumption was that this was rather unintended ...Nevermind. issue solved. Thanks again!</p>
]]></description><link>https://forum.qt.io/post/831476</link><guid isPermaLink="true">https://forum.qt.io/post/831476</guid><dc:creator><![CDATA[Leo Schubert]]></dc:creator><pubDate>Thu, 11 Sep 2025 17:14:39 GMT</pubDate></item><item><title><![CDATA[Reply to Qt6 on Mac: setIcon on a QAction not working since 6.7.3 on Thu, 11 Sep 2025 16:04:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/leo-schubert">@<bdi>Leo-Schubert</bdi></a> it isn't broken, it is just that since this version <code>Qt::AA_DontShowIconsInMenus</code> application attribute is enabled on default on macOS. You need to disable it yourself if you want them.</p>
<p dir="auto">Under the Big Sur design system, Mac applications customarily don't use icons in menus, so it made sense. They do make a comeback in the "Liquid Glass" design system of the upcoming macOS Tahoe.</p>
]]></description><link>https://forum.qt.io/post/831475</link><guid isPermaLink="true">https://forum.qt.io/post/831475</guid><dc:creator><![CDATA[IgKh]]></dc:creator><pubDate>Thu, 11 Sep 2025 16:04:19 GMT</pubDate></item><item><title><![CDATA[Reply to Qt6 on Mac: setIcon on a QAction not working since 6.7.3 on Thu, 11 Sep 2025 13:43:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/leo-schubert">@<bdi>Leo-Schubert</bdi></a> Did you check whether pix is a valid QPixmap (<a href="https://doc.qt.io/qt-6/qpixmap.html#isNull" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qpixmap.html#isNull</a>)?<br />
Using relative paths to load resources like pixmaps is dangerous. Usually one uses resource files.</p>
]]></description><link>https://forum.qt.io/post/831473</link><guid isPermaLink="true">https://forum.qt.io/post/831473</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Thu, 11 Sep 2025 13:43:38 GMT</pubDate></item></channel></rss>