我试图发出一个信号并发送两个参数,一个是 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/