为大量C++创建Python绑定QT库
简而言之: 您是否知道,或者有任何了解我如何实现下面提到的,python中的现有库
,无论是通过绑定还是任何其他可能的解决方案?
描述:
我正在从事一个项目,我的数量很大 自定义构建,快速变化 C ++ QT库
(版本5.15.2)我需要在python
中使用。
在过去的几周中,我对这个主题进行了很多研究。但是,我似乎找不到有关如何以适当方式执行绑定的合适解决方案。
我主要研究了shiboken
,因为那是QT Framework
正式支持和鼓励的Python绑定解决方案。
但是,shiboken
要求我使用我想在绑定中使用的每个方法的每个方法或所需部分的每个库的 type-system 和标头文件。这对我来说是一个问题,因为我需要在c ++
版本中存在的每种方法都存在于python
版本中,并且手工编写该文件几乎是不可能的。
他们将需要像其他任何库一样或以类似方式从Python脚本中调用它们。
Question in short:
Do you maybe know, or have any idea how I could implement the below mentioned, existing libraries in Python
, whether that be through bindings or any other possible solution?
Description:
I'm working on a project and I have a very large quantity of custom built, fast-changing C++ Qt Libraries
(version 5.15.2) that I need to use in Python
.
I have done a lot of research on the topic over the past few weeks. However I can't seem to find a suitable solution on how to perform the bindings in an appropriate way.
I have mainly researched Shiboken
, as that is the python bindings solution that the Qt Framework
officially supports and encourages.
However Shiboken
requires me to handwrite a type-system and header file for each library with each method or required part of that library that I want to use in my bindings. This is an issue for me as I require every method that is present in the C++
version to be present in the Python
version, and hand writing that file is practically impossible.
They will need to be called from Python scripts as any other library would, or in a similar manner.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
shiboken
可能是一个不错的选择。是的,您需要在 type-system 和 Header文件中指定每个类/struct/enum/namepace。但不是每种方法。如果您在type-system
文件中指定类,则将将所有类方法提取到python
。例如,此定义就足够了:另外,您可以查看
来源。提取到pyside
python
的库中有大量QT
。很好的例子。Shiboken
could be a good choice. Yes, you need to specify each class/struct/enum/namespace in a type-system and header file. But not each method. If you specify a class in atype-system
file, all the class methods will be extracted toPython
. For example, this definition is enough:Also, you can look at
PySide
sources. There is a big amount ofQt
libraries extracted toPython
. Good example.