Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. How to generate python bindings using shiboken from an existing C++/Qt shared library?
QtWS25 Last Chance

How to generate python bindings using shiboken from an existing C++/Qt shared library?

Scheduled Pinned Locked Moved Unsolved Language Bindings
shibokenpython3pythonpython support
6 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Alex94102A Offline
    Alex94102A Offline
    Alex94102
    wrote on last edited by
    #1

    I have a shared library built using qmake and leveraging several Qt modules (core, networking, etc...).

    What's the best path to pretty much convert that to something that can be used also from Python?

    All the examples that I was able to find don't address that usecase.

    https://doc.qt.io/qtforpython-5.12/shiboken2/samplebinding.html
    https://blog.basyskom.com/2019/using-shiboken2-to-create-python-bindings-for-a-qt-library/

    I was hoping there was going to be something that from the original "qmake" project could generate a default CMakeLists.txt file for generating the bindings. Or maybe should there be only one CMakeLists.txt file that would automatically build separate libraries (and bindings), for C++ and for Python?

    Thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      There was a talk about that during the Qt Virtual TechCon 2020. I think the video should be published at some point. There might be something there for you.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • Alex94102A Offline
        Alex94102A Offline
        Alex94102
        wrote on last edited by Alex94102
        #3

        awesome!! thank you!

        I just realized the videos are not listed, I previously posted URLs but I removed them. I was able to find a couple of good videos.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Great !

          Can you share them ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Alex94102A 1 Reply Last reply
          0
          • SGaistS SGaist

            Great !

            Can you share them ?

            Alex94102A Offline
            Alex94102A Offline
            Alex94102
            wrote on last edited by
            #5

            Hi @SGaist,

            These are the videos that I found, but I had to track down the authors for the actual code sample URLs.

            1. https://www.youtube.com/watch?v=mAfEVPgHRt8
              examples:
              https://github.com/sewoods/shiboken_simplegraph_example
              https://github.com/qt-ps-americas/pysideqwt

            and

            1. https://www.youtube.com/watch?v=Vb1dbLQafyM
              Examples:
              https://maureira.xyz/qtvts2020/code/

            Now, I realized that in order to get thing to work you need to have a good understanding of CMake works, plus the typesystem which can be tricky for complex datatypes where you need to write the mapping (to and from).

            1 Reply Last reply
            2
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Thanks for the links !

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved