I can retrieve the PyQt widget via Python C API, but it is a PyObject*, so how to convert PyObject* to a QObject* ? Once I have the QObject*, the rest should be easy in C++.<br><br>zhang<br><br><div class="gmail_quote">On Fri, Jul 22, 2011 at 5:21 PM, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On Tue, 19 Jul 2011 04:26:52 +0800, zhang jian <<a href="mailto:zhangmdev@gmail.com">zhangmdev@gmail.com</a>><br>
wrote:<br>
<div><div></div><div class="h5">> Hi,<br>
><br>
> I have a question about embedded PyQt inside a Qt (C++) app. For now I<br>
have<br>
> an app totally written in PyQt, then I want to embed it inside a Qt app<br>
> written in C++. I have no problem putting PyQt ui stuff inside a Qt<br>
Widget.<br>
> I can call stuff in PyQt from Qt using PyObject_CallMethod(), but I<br>
don't<br>
> know how to send signal from PyQt to Qt. I already have the PyObject* of<br>
> the<br>
> PyQt widget when I create the instance by PyObject_CallObject(). I try<br>
to<br>
> connect((QObject*)some_instance, SIGNAL("some_signal"), this,<br>
> SLOT(some_slot)), but no luck. I'd like to know if that is possible to<br>
> connect a signal in PyQt to a slot in Qt? If it is, how?<br>
<br>
</div></div>Assuming you are doing the connection from C++, and assuming that the<br>
signal is defined in Python using @pyqtSignal, then once you have a pointer<br>
to the underlying C++ QObject then just use the normal QObject::connect()<br>
call. Pass whatever you defined the signal to be using @pyqtSignal to your<br>
SIGNAL() call in C++.<br>
<font color="#888888"><br>
Phil<br>
</font></blockquote></div><br>