delay stop
This commit is contained in:
parent
94d0726b5c
commit
4c5803a6dd
1 changed files with 3 additions and 3 deletions
|
@ -10,7 +10,7 @@ Created on 2018年2月1日
|
||||||
@description:
|
@description:
|
||||||
'''
|
'''
|
||||||
from random import randint
|
from random import randint
|
||||||
import sys, time
|
import sys
|
||||||
|
|
||||||
from PyQt5.QtCore import QTimer, QThread, pyqtSignal
|
from PyQt5.QtCore import QTimer, QThread, pyqtSignal
|
||||||
from PyQt5.QtGui import QPainter, QColor, QPen
|
from PyQt5.QtGui import QPainter, QColor, QPen
|
||||||
|
@ -42,7 +42,7 @@ class LoadingThread(QThread):
|
||||||
def run(self):
|
def run(self):
|
||||||
for i in range(self.totalValue + 1):
|
for i in range(self.totalValue + 1):
|
||||||
self.valueChanged.emit(i / self.totalValue)
|
self.valueChanged.emit(i / self.totalValue)
|
||||||
QThread.msleep(randint(300, 600))
|
QThread.msleep(randint(50, 100))
|
||||||
|
|
||||||
|
|
||||||
class PushButtonLine(QPushButton):
|
class PushButtonLine(QPushButton):
|
||||||
|
@ -82,7 +82,7 @@ class PushButtonLine(QPushButton):
|
||||||
self.loadingThread.valueChanged.disconnect(self.setPercent)
|
self.loadingThread.valueChanged.disconnect(self.setPercent)
|
||||||
self.loadingThread.terminate()
|
self.loadingThread.terminate()
|
||||||
self.loadingThread.deleteLater()
|
self.loadingThread.deleteLater()
|
||||||
time.sleep(1) #延迟等待deleteLater执行完毕
|
QThread.msleep(100) # 延迟等待deleteLater执行完毕
|
||||||
del self.loadingThread
|
del self.loadingThread
|
||||||
self._percent = 0
|
self._percent = 0
|
||||||
self._timer.stop()
|
self._timer.stop()
|
||||||
|
|
Loading…
Reference in a new issue