我试图将参数发送到不是主线程的 Qthread。我的主线程中有这个对象,我想将它发送到另一个线程:
q = Queue()
我想发送q
到这个线程:
class Sender(QtCore.QThread):
def __init__(self,q):
super(Sender,self).__init__()
self.q=q
def run(self):
while True:
try: line = q.get_nowait()
# or q.get(timeout=.1)
except Empty:
pass
else:
self.emit(QtCore.SIGNAL('tri()'))
我正在尝试这个:
class Sender(QtCore.QThread):
def __init__(self,q):
super(Sender,self).__init__()
self.q=q
self.sender= Sender(q)
但我收到这个错误:
QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
我怎样才能做到这一点?请帮忙!