[Development] QMetaMethod in Qt 6
thiago.macieira at intel.com
Fri May 29 00:11:20 CEST 2020
On Thursday, 28 May 2020 10:19:58 PDT Adam Light wrote:
> I'm including generating moc files in "build time". I'm not saying that
> compiling the .cpp files will take significantly longer, but if a .cpp file
> has a #include "myclass.moc" type statement, that .cpp file has to be
> processed by moc
You're talking about when myclass.cpp has a Q_OBJECT. That's the only reason
when moc needs to parse that .cpp.
But you also don't have a choice. You have to #include the .moc output.
We're talking about #include "moc_myclass.cpp", which is when "myclass.h" has
a Q_OBJECT. You don't have to have that #include. But if you do, then it's one
fewer .cpp file that needs to be compiled. It generates better code and
enables more warnings.
The only drawback is that the compilation needs to wait for moc to finish. If
you have a cluster, it means the cluster can't be used until moc has finished,
for that file. But that's only for the first file.
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel System Software Products
More information about the Development