我尝试为我的PySide2应用程序中的QRunnable对象创建自定义信号。所有示例都让我按照以下方式创建信号:
class Foo1(QtCore.QObject):
def __init__():
super().__init__()
self.thread = Foo2()
self.thread.signal.connect(foo)
def foo():
# do something
class Foo2(QtCore.QRunnable):
signal = QtCore.Signal()
然而,在
self.thread.signal.connect(foo)
处,我遇到了以下错误:'PySide.QtCore.Signal' object has no attribute 'connect'
我应该如何为QRunnable对象实现自定义信号?
QRunnable is not a QObject
made my day. Thank you! I though every class that starts withQ
is aQObject
- RedEyed