[Qt-interest] How to write CMakeLists.txt when Q_OBJECT inxxx.cpp file

Scott Aron Bloom Scott.Bloom at onshorecs.com
Sat Jul 31 18:19:30 CEST 2010


\
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Guido Seifert
Sent: Saturday, July 31, 2010 9:04 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] How to write CMakeLists.txt when Q_OBJECT inxxx.cpp file




> Thank you, but this does not work if your xxx.cpp file contains Q_OBJECT.

Come to think about this, does this even work? I mean Q_OBJECT in .cpp not in .h?  Q_OBJECT belongs in the class declaration, which is usually found in the header. Should not even compile if you have signals or slots in your header.

Guido

-- 
--------------
Its quite common, for "hidden" simple classes to have them fully declared in a CPP file.

The usual solution is to include the generated moc_XXXX.cpp file at the end of the CPP file

Scott




More information about the Qt-interest-old mailing list