[kde-edu]: more problems with KNewStuff
Dominique Devriese
devriese at kde.org
Wed Jun 2 09:31:49 CEST 2004
Jason Harris writes:
> Hello, I have subclassed my own KNewStuff (named KSNewStuff), and
> with the help of others, I have gotten to the point where I can
> actually retrieve a tarball and have it installed under KDEHOME.
> The next step is to incorporate the new data into the program.
> There are several different data files that can be downloaded, and
> the program must behave differently in each case. To handle this, I
> wanted to use the 'created(QString)' signal of a KDirWatch object,
> monitoring the .../share/apps/kstars/ dir. This is connected to a
> Slot in KSNewStuff that does the various installation steps, based
> on the filename of the newly created file.
> That's the idea, but I am having trouble implementing it. KNewStuff
> is not a QObject, so I am having trouble making a slot in
> KSNewStuff. I am defining KSNewStuff like this:
> class KSNewStuff : public KNewStuff, public QObject
> but when compiling, I get really weird errors in ksnewstuff.moc
> (which are appended below). I don't know what these mean, but my
> guess is that KSNewStuff is still not a QObject somehow, despite its
> inheritance. Is that close to the right answer? Before you ask:
> yes, I do have "Q_OBJECT" in the definition of KSNewStuff, and I
> have '#include "ksnewstuff.moc" ' at the end of ksnewstuff.cpp.
>From http://doc.trolltech.com/3.3/moc.html
Multiple inheritance requires QObject to be first
If you are using multiple inheritance, moc assumes that the first
inherited class is a subclass of QObject. Also, be sure that only the
first inherited class is a QObject.
class SomeClass : public QObject, public OtherClass {
...
};
(This limitation is almost impossible to remove; since the moc does
not expand #include or #define, it cannot find out which one of the
base classes is a QObject.)
cheers
domi
More information about the kde-edu
mailing list