[C++-sig] [Urgent Question] Import Qt builded Lib into python with Boost.python
by Cheng Lee other posts by this author
Oct 9 2009 9:01PM messages near this date
Re: [C++-sig] [python] python + phoenix
|
[C++-sig] "pass all args in list" syntax
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.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basi
cs.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
|