[PyQt] Hybrid C++ and Python in a Qt GUI

Eric Frederich eric.frederich at gmail.com
Thu Nov 20 20:38:41 GMT 2014


On Thu, Nov 20, 2014 at 12:30 PM, Phil Thompson <phil at riverbankcomputing.com
> wrote:

> On 20/11/2014 2:41 pm, Eric Frederich wrote:
>
>> Hello,
>>
>> We're starting a new project, no C++ code or Python code.
>> In fact, we're porting a bunch of Tcl code.
>>
>> Anyway, at the end of this project I'd like to have a Qt GUI where a
>> developer can create a new tool for the application in either C++ or
>> Python.
>>
>> My question:
>> What is the best approach for something like this?
>>
>> My assumption:
>> Please don't dwell on this if it is completely wrong, just disregard it
>> and
>> answer the above question.
>> Assumption: the host should be PyQt since PyQt can integrate C++
>> components
>> via SIP but a C++/Qt application cannot easily integrate a PyQt component.
>>
>
> Wrong assumption. Take a look at the Python API - there is nothing special
> about PyQt as far as it is concerned.


So there is a way, from a PyObject*, to get a usable instance of a QObject
that I could use from C++?


>


>
>  Another assumption: My PyQt stuff would be able to connect to C++ signals
>> /
>> Slots but my C++ stuff would not be able to connect to my Python signals /
>> slots.  Is this true?
>>
>
> No. Signals and slots defined in Python are added to the QMetaObject and
> so are accessible from C++ like any C++ signal or slot.
>

I guess I haven't done enough C++ programming to know about that.  I
thought that the C++ compiler had to know about the signals / slots.


>
> Phil
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20141120/4b65b4fe/attachment.html>


More information about the PyQt mailing list