python - 不支持 C++ 类型槽参数

标签 python qt4 pyqt4

我试图发出一个信号并发送两个参数,一个是 Song 对象的列表,第二个是一个 QtGui.QTableView 对象。

我试过这样做:

self.emit(QtCore.SIGNAL("searchOutput(list, QtGui.QTableView)"), songsObjs, self.table)

但是我得到以下错误:

TypeError: C++ type 'list' is not supported as a slot argument type

我能做什么?

最佳答案

如果您查看 reference然后它说

It is possible to pass any Python object as a signal argument by specifying PyQt_PyObject as the type of the argument in the signature.

While this would normally be used for passing objects like lists and dictionaries as signal arguments, it can be used for any Python type.

所以尝试这样做:

self.emit(QtCore.SIGNAL("searchOutput(PyQt_PyObject, QtGui.QTableView)"), songsObjs, self.table)

关于python - 不支持 C++ 类型槽参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9853176/

相关文章:

python - QLineEdit 中的文本不显示

python - 如何从 Python 中的嵌套字典中删除某些键?

python - 在串行连接中将字符串转换为 int

python - 为什么opencv-python中相机标定需要30多分钟?

c - 使用 QtCreator [mac os] 找不到 -lrt 的库

python - 通过复选框 PyQt 始终处于最前面的行为

python - Apache Flink : Kafka connector in Python streaming API, "Cannot load user class"

c++ - 如何在QT中将gui组件的选定区域提取为PDF

c++ - QAbstractItemModel + ModelTest::rowsInserted ASSERTion问题

python - xvfb 在 ubuntu 11.04 中运行错误