[PyKDE] Trouble binding code with SIP
Phil Thompson
phil at riverbankcomputing.co.uk
Mon Oct 13 18:51:00 BST 2003
On Monday 13 October 2003 5:30 pm, Aurélien Gâteau wrote:
> Le Lundi 13 Octobre 2003 18:23, Phil Thompson a écrit :
> > That wouldn't make any difference. The %HeaderCode section in a class
> > definition is used to #include all header files needed by that class -
> > normally just the one.
>
> I just tried it again. I made some simplifications, like putting my
> Listener into DolSphinx namespace, so here is the new sip file (only one
> now).
I said put the %HeaderCode section in the class definition.
I was also going to say that you probably also need to add a %HeaderCode
section to the DolSphinx namespace that #includes dolsphinx.h - but looking
quickly at the parser I'm not sure it allows you to. If so then that's
something I need to fix.
Phil
> --- dolsphinx.sip ---
> %Module dolsphinx
>
> %Import qtmod.sip
>
> %HeaderCode
> #include <dolsphinx.h>
> #include <dolsphinxlistener.h>
> %End
>
>
> namespace DolSphinx {
> enum State { Uninitialized, Initializing, Listening, Calibrating,
> Paused };
>
> class Listener : QObject {
> public:
> Listener(QObject* /TransferThis/ = 0);
> ~Listener();
>
> void wordConnect(const QString&, SIP_RXOBJ_CON,SIP_SLOT_CON());
> void wordDisconnect(const QString&, SIP_RXOBJ_CON,SIP_SLOT_CON());
>
> signals:
> void wordHeard(const QString&);
> void stateChanged(DolSphinx::State);
> };
>
> /* function snip */
>
> DolSphinx::Listener* listener();
> void setListener(DolSphinx::Listener*);
>
> DolSphinx::State state();
>
> DolSphinx::State stringToState(const QString&);
> QString stateToString(DolSphinx::State);
> };
> ---
>
> What is interesting is that it does not fail on
> "stateToString(DolSphinx::State)". Maybe it has something to do with the
> fact that stateChanged is a signal.
>
> The broken file is sipdolsphinxProxydolsphinx.h. It's content is:
>
> --- sipdolsphinxProxydolsphinx.h ---
> // Module proxy signal/slot handler class.
> //
> // Generated by SIP 3.7 (build 102) on Mon Oct 13 18:25:41 2003
>
> #ifndef _dolsphinxPROXY_H
> #define _dolsphinxPROXY_H
>
> #include <sipQt.h>
>
> #include <qobject.h>
> #include <qapplication.h>
> #include <qstring.h>
>
> class sipProxydolsphinx: public sipProxy
> {
> Q_OBJECT
>
> public:
> char *getProxySlot(char *);
>
> public slots:
> void proxySlot(DolSphinx::State); // <- compilation fails here
> void proxySlot(const QString&);
> void proxySlot(QObject *);
> void proxySlot();
> };
>
> #endif
> ---
>
> Aurélien
>
> _______________________________________________
> PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
More information about the PyQt
mailing list