[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: mixing PyQt(5) and Boost.Python
From:       Stefan Seefeld <stefan () seefeld ! name>
Date:       2021-07-21 13:20:59
Message-ID: b17157c4-f14f-38f6-cd57-539ecdfd8f39 () seefeld ! name
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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 ?

Thanks !

Stefan
-- 

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


[Attachment #5 (multipart/related)]

[Attachment #7 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2021-07-21 2:57 a.m., Phil Thompson
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1fc516d9826909aa31b57e2d576f9ced@riverbankcomputing.com">On
      20/07/2021 21:44, Stefan Seefeld wrote:
      <br>
      <blockquote type="cite">Hello,
        <br>
        <br>
        I'm working on Python bindings for a set of C++ libraries /
        <br>
        applications, some of which are using Qt.
        <br>
        The application code is instantiating many Qt objects, some of
        which I
        <br>
        now want to expose to Python. For in-house C++ APIs this is
        easy, as I
        <br>
        merely need to reflect the C++ types to Python using
        Boost.Python, so
        <br>
        I can have functions such as
        <br>
        <br>
        ```
        <br>
        class A;
        <br>
        std::shared_ptr&lt;A&gt; create_a();
        <br>
        ```
        <br>
        exposed to Python such that both, the type `A` as well as the
        function
        <br>
        `create_a()` are known in Python.
        <br>
        <br>
        Now assume `A` is actually a type with an existing Python
        wrapper in
        <br>
        PyQt5. How can I instantiate `A` in C++ and then pass it to the
        Python
        <br>
        runtime such that the PyQt5 bindings are used ? (To make this
        <br>
        concrete, I want to make the `QQMLApplicationEngine` instance of
        my
        <br>
        C++ app accessible in Python, so that I can use Python to script
        and -
        <br>
        more importantly - introspect and test my application's GUI.
        <br>
        <br>
        Any pointers ?
        <br>
      </blockquote>
      <br>
      Start with this...
      <br>
      <br>
<a class="moz-txt-link-freetext" \
href="https://www.riverbankcomputing.com/static/Docs/sip/abi_12.html#abi-v12-for-handw \
ritten-code">https://www.riverbankcomputing.com/static/Docs/sip/abi_12.html#abi-v12-for-handwritten-code</a>
  <br>
    </blockquote>
    <p>It looks like the functions I'm looking for are `<code
        class="sig-name descname">sipConvertFromNewType</code><span
        class="sig-paren">` and `</span><span class="sig-paren"><code
          class="sig-name descname">sipConvertFromType</code><span
          class="sig-paren">`, correct ?</span></span></p>
    <p><span class="sig-paren"><span class="sig-paren">Thanks !<br>
        </span></span></p>
    <div class="moz-signature">
      <div class="moz-signature">
        <div class="moz-signature">
          <pre><img moz-do-not-send="false" \
                src="cid:part1.22C37844.7BA4DC20@seefeld.name" alt="Stefan" \
                width="123" height="77">
-- 

      ...ich hab' noch einen Koffer in Berlin...
</pre>
        </div>
      </div>
    </div>
  </body>
</html>


[".signature.png" (image/png)]
["stefan.vcf" (text/x-vcard)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic