Trying to understand moc

Andreas Pakulat apaku at gmx.de
Thu Mar 29 18:57:22 BST 2007


Hi,

IIRC there are two "points of contact" at TT reading this list (don't
remember the names though), I'd like to understand some weirdness wrt.
to moc and interfaces in Qt4.

Qt's Designer has some nice API to define extension interface which
KDevelop and the KDevPlatform code is using to have plugins that can
break BC anytime, without breaking the application. There's
unfortunately a minor problem with this:

The macro's that are defined to declare an extension interface do not
work when having the interface inside a Namespace. The issue is easily
fixable by providing a new macro that takes the namespace as a separate
parameter and KDevelop defines such a macro.

This KDEV_DECLARE_EXTENSION_INTERFACE macro looks very similar to
Q_DECLARE_EXTENSION_INTERFACE, but for some reason it can't embed the
Q_DECLARE_INTERFACE macro in it (like the Q_DECLARE_EXTENSION_INTERFACE
maro does). The problem here is that moc then doesn't know about the
declared interface and bails out when moccing the plugin's header that
has

Q_INTERFACES( IFace )

I tried to read the moc parsing code, but didn't succeed as to why
Q_DECLARE_EXTENSION_INTERFACE works, but out own macro doesn't. But the
parsing code is rather complex and seems to be generated. I didn't see
any code that recognizes Q_DECLARE_EXTENSION_INTERFACE and treats it
specially, so there must be something else...

So basically I'm looking for a way to not have to use vthe
Q_DECLARE_INTERFACE macro  when defining an interface (i.e. 2 macros,
the KDEV one because of the NS and the Q one for moc). The attached code
demonstrates the problem, just run it through moc and you see it
complains for the first macro but doesn't for the other 2.

I'm happy to report this as a bug to TT if somebody says it looks like
one, it certainly doesn't look like a bug to me (yet).

Andreas

-- 
Go to a movie tonight.  Darkness becomes you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iface.h
Type: text/x-chdr
Size: 258 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070329/6d2e015b/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macro.h
Type: text/x-chdr
Size: 102 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070329/6d2e015b/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plugin.h
Type: text/x-chdr
Size: 196 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070329/6d2e015b/attachment-0002.h>


More information about the kde-core-devel mailing list