Answer the question
In order to leave comments, you need to log in
How to catch finished() signal for a separate thread in pyqt5?
In general.
The following code creates an object of the QThread instance class
# Создаем новый поток и прослушиваем слот
self.myThread = jobThread(self.isJobStopped, self.spinBox.value()) # Создаем обьект класса и передаем ему нужные аргументы
self.myThread.jobSignal.connect(self.addLog) # Прослушиваем кастомный сигнал
self.myThread.start() # Создаем поток
self.myThread.terminate()
self.connect(self.myThread, SIGNAL("finished()"), self.addLog('Программа завершена'))
self.connect(self.myThread, SIGNAL("jobSignal(str)"), self.addLog) # PyQt4
self.myThread.jobSignal.connect(self.addLog) # PyQt5
self.myThread.finished().connect(self.addLog)
Answer the question
In order to leave comments, you need to log in
Problem solved.
In PyQt5, you need to call not finished() but finished.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question