Shiboken2: std::function or any "SLOT" type
-
Hello,
I am trying to generate shiboken bindings for a lib that usestd::function. How can I do that ?I have this struct:
struct Callback { std::function<void(Peer* sender, QStringList params)> cb; QObject* context; };When I generate shiboken bindings for it, the
cbfield disappear, as seen in this extract of the python help:| ---------------------------------------------------------------------- | Data descriptors defined here: | | contextI can modify the original library is needed, so I have two questions:
- How can I generate bindings for
std::function? - If this is not possible or hard to do, is there a way to declare a slot type?
Thanks
- How can I generate bindings for
-
Hey,
you can check the code of existing bindings that workaroundstd::functionarguments. You can look into the implementation ofQThreadPool.start(std::function)binding, which internally accepts aPyCallable.
Here you have the change: https://codereview.qt-project.org/c/pyside/pyside-setup/+/369427