Q_PROPERTY is c++ macros?
-
Hi.
Who known Q_PROPERTY is c++ macros? And there his defined (in qobjectdefs.h just dummy). -
Hi.
See following useful links
"moc":http://qt-project.org/doc/qt-5/metaobjects.html#meta-object-system
Hope this helps.
-
Hi,
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. -
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:
http://clang.llvm.org/docs/ClangTools.htmlUse then if new api lost backward compatibility