我正在尝试将 qimage2ndarray 从 PyQt 移植到 PySide。如果我将导入从 PyQt 更改为 PySide,则代码的 python 部分似乎可以工作,但 SIP 部分
http://www.informatik.uni-hamburg.de/~meine/hg/qimage2ndarray/file/0682b7bcaca3/qimageview.sip
没有。它给出了错误:
qimageview(): argument 1 has unexpected type 'PySide.QtGui.QImage'
我对此感到很惊讶,因为这个函数是用
定义的qimageview(QImage &image)
如何将 PySide.QtGui.QImage
转换为可在 C++ 中使用的 QImage
?
我从未使用过 SIP,也没有使用过 scipy.weave 将 C++ 嵌入到 Python 中。也许 SIP 不是使用 PySide 的正确方式?!
最佳答案
不,sip 不是正确的工具。
尽管sip是为 C/C++ 库创建 python 绑定(bind)的通用工具,它不直接与 PySide 兼容,PySide 使用不同的工具生成其绑定(bind)。
相当于 sip 的 PySide 是 shiboken .
关于c++ - 将 PySide 对象传递给 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20197011/