mixing PyQt(5) and Boost.Python

Stefan Seefeld stefan at seefeld.name
Mon Sep 20 18:52:12 BST 2021

Hello Phil,

allow me to come back to this:

On 2021-07-21 9:20 a.m., Stefan Seefeld wrote:
> On 2021-07-21 2:57 a.m., Phil Thompson wrote:
>> On 20/07/2021 21:44, Stefan Seefeld wrote:
>>> Hello,
>>> I'm working on Python bindings for a set of C++ libraries /
>>> applications, some of which are using Qt.
>>> The application code is instantiating many Qt objects, some of which I
>>> now want to expose to Python. For in-house C++ APIs this is easy, as I
>>> merely need to reflect the C++ types to Python using Boost.Python, so
>>> I can have functions such as
>>> ```
>>> class A;
>>> std::shared_ptr<A> create_a();
>>> ```
>>> exposed to Python such that both, the type `A` as well as the function
>>> `create_a()` are known in Python.
>>> Now assume `A` is actually a type with an existing Python wrapper in
>>> PyQt5. How can I instantiate `A` in C++ and then pass it to the Python
>>> runtime such that the PyQt5 bindings are used ? (To make this
>>> concrete, I want to make the `QQMLApplicationEngine` instance of my
>>> C++ app accessible in Python, so that I can use Python to script and -
>>> more importantly - introspect and test my application's GUI.
>>> Any pointers ?
>> Start with this...
>> https://www.riverbankcomputing.com/static/Docs/sip/abi_12.html#abi-v12-for-handwritten-code 
> It looks like the functions I'm looking for are 
> `|sipConvertFromNewType|` and `|sipConvertFromType|`, correct ?

What header file(s) do I need to include in my own C++ code to make the 
`sipConvertFromNewType` function visible ? The generic "sip.h" header 
doesn't seem to provide it. grepping through the code I only see the 
symbol defined as a macro in generated headers, but those don't seem to 
be installed anywhere.

Thanks !


       ...ich hab' noch einen Koffer in Berlin...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210920/eaf2663a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .signature.png
Type: image/png
Size: 2754 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210920/eaf2663a/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stefan.vcf
Type: text/x-vcard
Size: 4 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210920/eaf2663a/attachment.vcf>

More information about the PyQt mailing list