Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Q_PROPERTY is c++ macros?
Who known Q_PROPERTY is c++ macros? And there his defined (in qobjectdefs.h just dummy).
IamSumit last edited by
See following useful links
Hope this helps.
giesbert last edited by
the moc macros have two use cases:
moc uses them to create the xxx_moc.cpp files. He ionterprets the content
cpp compiler does not need them, so the define is a dummy.
Thank you very much for the detailed answer.
It's like, it's an interesting technique. Now I have no doubt that this is the only possible way extend the standard preprocessor macros functionality.
andre last edited by
Please keep in mind that Qt is already quite old. Chances are, that if it were designed from the ground up today, it would not come up with moc again. However, back in the day, template support in C++ was still in its infancy, and Qt has needed to support compilers for lots of different platforms over the years, some of which with quite old toolchains. Also, computers were less powerfull back then.
So, it might be possible that if Qt were designed today, the issues that moc is now solving would have been approached differently, perhaps with templates. Or not.
There is even experimental work around that basically replaces moc with Clang extensions. Extremely cool. Clang allows you to augment the actual compiler, and so it becomes possible to define your own keywords and insert code based on this. Last I heard from it, it produces working code... But as we cannot all rely on Clang, and other compilers that Qt is supporting don't offer the same functionality yet, I think we're going to be stuck with moc for a while longer.
I recommend to look at here is what kind of tools:
Use then if new api lost backward compatibility