class SSHThread(QThread): def __init__(self, hostname = '', renderList = [], tabLabelText = 'L0001', parent = None): """ constructor""" ...omit... #a new custom signal to set string to textEdit self.editSignal = pyqtSignal(QString, QString) ...omit... def run(self): """ emit the new signal""" ... omit ... self.emit(SIGNAL('editSignal(QString, QString)'), QString("param1"), QString("param2")) ... omit ... ...... omit ...... def executeBtn(self): """ connect the new signal and a slot function""" QObject.connect(self.sshThread, SIGNAL('editSignal(QString, QString)'), self.on_textEdit_update) ... omit ... def on_textEdit_update(self, param1, param2): """ the slot function""" ... omit ... ================================================ 20151223補充一個完整例子,來源: http:///questions/3891465/how-to-connect-pyqtsignal-between-classes-in-pyqt
|
|