[Kstars-devel] moc files

Jason Harris kstars at 30doradus.org
Sat May 15 05:04:37 CEST 2004


Hi Jeff,

Classes which use Qt extensions such as the SIGNAL/SLOT mechanism must 
have the line "Q_OBJECT" in their header file.  This signals the 
Makefile to parse the header with the Qt precompiler ("moc"), which 
generates C++ code to handle the Qt stuff.  The generated file for the 
class defined in "foo.h" is named "foo.moc.cpp" by default, but KDE 
policy is to override this by placing a '#include "foo.moc" ' line in 
the source file ("foo.cpp").  In that case, moc will generate "foo.moc" 
instead.

I might have some of the details of that wrong, but that's my 
understanding of it.  Basically, if you will use signals and slots in a 
class, put the 'Q_OBJECT' line in the header, and put '#include 
"foo.moc"' in the source file.  The KDE autoconf/automake chain will 
take care of the rest.

hope that helps,
Jason
 
On Friday 14 May 2004 02:07 pm, Jeff Woods wrote:
> I've noticed that the .moc files are #included at the bottom of each
> .cpp file, but they are not mentioned in the Makefile and are not
> present in CVS.  Something is triggering their being built during the
> build process, but I can't find any reference to it.  How is this
> done?
>
> _______________________________________________
> Kstars-devel mailing list
> Kstars-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kstars-devel

-- 
KStars: A KDE Planetarium
http://edu.kde.org/kstars


More information about the Kstars-devel mailing list