Reputation: 91
it got me crazy as I just started using QThread. Here is a short program to test using QThread.
i want to make all thread stopped when STOP button is being pressed. However just only one thread stop. why this problem is happend?
Upvotes: 0
Views: 85
Reputation: 5336
When you click on the stop button, you just call self.downloader.stop()
. At this point, self.downloader is the last thread you created, namely Thread-5. So it makes sense that only Thread-5 stops. You have to modify the stop
slot. Something like this may work:
def stop(self):
for thread in self.threads:
thread.stop()
Upvotes: 1