[C++-sig] [Urgent Question] Import Qt builded Lib into python with Boost.python

Cheng Lee yooi at msn.com
Sat Oct 10 06:00:52 CEST 2009

Hello All,


Our project made some of the functions with Qt and also encapsulate them with dll library, 

the imported module, we made it following the boost.python syntax, was built successfully, 

and imported into python 2.6.2 with no errors, but our issues are, the functions donot work, no response


as our investigation, it supposes to be Qt signal/slot donot work in the python module


I made a simple example below:

Would someone help me check what codes i need add to make the signal/slot work in the python, Thanks a lot


Boost 1.40

Python 2.6.2


#ifndef SIGALE_H
#define SIGALE_H


class SignalMine : public QObject
    SignalMine(QObject* parent = 0);
    void submit(void){emit trigger();}
    void trigger(void);
protected slots:
    void printOut(void);





SignalMine::SignalMine(QObject* parent):QObject(parent)
    connect(this, SIGNAL(trigger()), this, SLOT(printOut()));    

void SignalMine::printOut()
      cout << "Get signal!" << endl;  


//! for boost.python

#include <boost/python.hpp>
using namespace boost::python;

    class_<QObject, boost::noncopyable>("QObject");
    class_<SignalMine, boost::noncopyable, bases<QObject>>("SignalMineller")
        .def("submit", &SignalMine::submit);


Keep your friends updated―even when you’re not signed in.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20091010/3af8642c/attachment.htm>

More information about the Cplusplus-sig mailing list