<?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[lupdate and macros. using Q_OBJECT in your own macro.]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">I have a C/C++ project using Qt 6.5.3 and the lupdate translation tool.<br />
For generating the .ts translation file we run the lupdate tool over the source as required.<br />
However a lot of the files have a custom macro MY_Q_OBJECT that expands to call Q_OBJECT.</p>
<p dir="auto">However, ( as I understand it ) the lupdate tool doesn't actually look at the expanded macro and simply uses the text as is, I'm getting a number of warning messages when doing lupdate. eg.<br />
<code>Folder.h:23: Class 'Folder' lacks Q_OBJECT macro</code></p>
<p dir="auto">Is there any way to tell lupdate that my  MY_Q_OBJECT is OK, and that it is equivalent to an actual Q_OBJECT for it's processing?</p>
<p dir="auto">I've tried messing with the <code>-tr-function-alias</code> argument, but it didn't work for me?<br />
<code>lupdate.exe Folder.h -ts translation.ts -tr-function-alias Q_DECLARE_TR_FUNCTIONS=MY_Q_OBJECT</code><br />
I think that is suppose to provide an alias for functions in the code anyway.</p>
<p dir="auto">I've also seen some suggestion that<br />
<code>lupdate -D"MANAGED_OBJECT=Q_OBJECT"</code><br />
might work too, but that doesn't seem to work at all - I think the <code>-D</code> is a moc argument not an lupdate argument</p>
<p dir="auto">Adding custom code to each file just to remove the lupdate warning is not a viable solution.<br />
surely there must be some way to do this?</p>
<p dir="auto">regards,</p>
<p dir="auto">James</p>
]]></description><link>https://forum.qt.io/topic/164885/lupdate-and-macros.-using-q_object-in-your-own-macro.</link><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Sep 2026 18:07:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164885.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Jul 2026 04:06:49 GMT</pubDate><ttl>60</ttl></channel></rss>