Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Managing Qt event loop in a Python binding created from C++ library
Forum Updated to NodeBB v4.3 + New Features

Managing Qt event loop in a Python binding created from C++ library

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 232 Views 1 Watching
  • 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.
  • G Offline
    G Offline
    glamis
    wrote on last edited by
    #1

    I have a C++ library that depends on Qt5 and uses signal/slots internally (mainly for communicating between threads and for QTimers). The library is currently being used for qt GUI application and everything works fine.

    I want to expose some of the API to Python so that the library could be used as a regular python module in a standalone Python script. I created the bindings using pyside11 and I'm able to call the C++ function from Python as expected.

    However none of the signal/slots used internally works as there is no QCoreApplication instance and no event loop in the Python. I tried exposing an instance of QCoreApplication and the QCoreApplication::exec function (using pybind11) however as exec() function will block the execution, I can't use it in Python.

    Is there a workaround so that I can still use my library as a regular Python module and the internal signal/slots runs normally.

    I would prefer something that doesn't involve adding PySide2 dependency to the Python side especially as the scripts won't any Qt specific functions.

    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