automoc4 corner issues - what lerned from qt-creator port
Helio Chissini de Castro
helio at kde.org
Wed Mar 25 17:38:46 CET 2009
On Wednesday 25 of March 2009 13:07:07 Matthias Kretz wrote:
> On Tuesday 24 March 2009 19:36:19 Helio Chissini de Castro wrote:
> > 4 - w.cpp have an internal Q_OBJECT class and includes w.h with other
> > class with Q_OBJECT but have no moc includes.
>
> Not sure I understand. If the class declaration is in w.cpp but no moc
> included how do you compile a moc file generated from that w.cpp file?
> Because in order to compile the generated moc file you need the class
> declaration, but that's only in w.cpp which you can't include from the
> moc... So what am I missing?
Something like this:
-------------------- w.cpp ---------------------------------
#include <QObject>
#include "w.h"
class Z : public QObject
{
Q_OBJECT
public:
Z() {};
};
W::W()
{
}
int main()
{
W w;
return 0;
}
-------------------------------------------------------------------
------------------------ w.h --------------------------------
#include <QObject>
class W : public QObject
{
Q_OBJECT;
public:
W();
};
-----------------------------------------------------------------
So, as you see, both header and cpp have no moc includes
automoc4 test, see that aren't any includes, enter in the first situation
( matchOfset < 0 ) and only test if there is Q_OBJECT on w.h or w_p.h,
suddenly generating a moc_w.cpp
But since we have a Z class in the cpp with a Q_OBJECT, they should be moc'd
as well, generating w.moc too. The revised last patch solve this case too
already.
--
Helio Chissini de Castro
KDE Developer
Brasil/South America Primary Contact
More information about the Kde-buildsystem
mailing list