Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. lupdate and macros. using Q_OBJECT in your own macro.
Qt 6.11 is out! See what's new in the release blog

lupdate and macros. using Q_OBJECT in your own macro.

Scheduled Pinned Locked Moved Unsolved General and Desktop
lupdatemacroqobjecttranslation
1 Posts 1 Posters 63 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jammin44fm
    wrote last edited by Jammin44fm
    #1

    Hi all,

    I have a C/C++ project using Qt 6.5.3 and the lupdate translation tool.
    For generating the .ts translation file we run the lupdate tool over the source as required.
    However a lot of the files have a custom macro MY_Q_OBJECT that expands to call Q_OBJECT.

    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.
    Folder.h:23: Class 'Folder' lacks Q_OBJECT macro

    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?

    I've tried messing with the -tr-function-alias argument, but it didn't work for me?
    lupdate.exe Folder.h -ts translation.ts -tr-function-alias Q_DECLARE_TR_FUNCTIONS=MY_Q_OBJECT
    I think that is suppose to provide an alias for functions in the code anyway.

    I've also seen some suggestion that
    lupdate -D"MANAGED_OBJECT=Q_OBJECT"
    might work too, but that doesn't seem to work at all - I think the -D is a moc argument not an lupdate argument

    Adding custom code to each file just to remove the lupdate warning is not a viable solution.
    surely there must be some way to do this?

    regards,

    James

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved