[PyKDE] Trouble binding code with SIP

Aurélien Gâteau aurelien at dental-on-line.fr
Mon Oct 13 18:31:00 BST 2003


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).

--- 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




More information about the PyQt mailing list