[Urgent Question] Import Qt builded Lib into python with Boost.python

View: New views
1 Messages — Rating Filter:   Alert me  

[Urgent Question] Import Qt builded Lib into python with Boost.python

by Cheng Lee-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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
++++++++++++++++++++++++++++++++++++++++++++++++++.h
#ifndef SIGALE_H
#define SIGALE_H
#include<QObject>
 
class SignalMine : public QObject
{
    Q_OBJECT
public:
    SignalMine(QObject* parent = 0);
   
    void submit(void){emit trigger();}
signals:
    void trigger(void);
   
protected slots:
    void printOut(void);
   
};
#endif
++++++++++++++++++++++++++++++++++++++++++++++++++.cpp
#include<iostream.h>
#include"example.h"
 
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;
BOOST_PYTHON_MODULE(SIGN)
{
    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.
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@...
http://mail.python.org/mailman/listinfo/cplusplus-sig