This commit is contained in:
Irony 2019-01-07 16:20:00 +08:00
commit b4d575e76e
2 changed files with 3 additions and 2 deletions

View file

@ -4,6 +4,7 @@ encoding//Demo/FacePoints.py=utf-8
encoding//Demo/FollowWindow.py=utf-8 encoding//Demo/FollowWindow.py=utf-8
encoding//Demo/FramelessWindow.py=utf-8 encoding//Demo/FramelessWindow.py=utf-8
encoding//Demo/Lib/Application.py=utf-8 encoding//Demo/Lib/Application.py=utf-8
encoding//Demo/Lib/FramelessWindow.py=utf-8
encoding//Demo/NativeEvent.py=utf-8 encoding//Demo/NativeEvent.py=utf-8
encoding//Demo/Notification.py=utf-8 encoding//Demo/Notification.py=utf-8
encoding//Demo/ProbeWindow.py=utf-8 encoding//Demo/ProbeWindow.py=utf-8

View file

@ -9,7 +9,7 @@ Created on 2018年3月9日
@file: moveToThread @file: moveToThread
@description: moveToThread @description: moveToThread
""" """
from PyQt5.QtCore import QObject, pyqtSignal, QThread, QTimer from PyQt5.QtCore import QObject, pyqtSignal, QThread
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QPushButton from PyQt5.QtWidgets import QWidget, QVBoxLayout, QProgressBar, QPushButton
@ -52,8 +52,8 @@ class Window(QWidget):
def onStart(self): def onStart(self):
print('main id', int(QThread.currentThreadId())) print('main id', int(QThread.currentThreadId()))
self._thread.started.connect(self._worker.run)
self._thread.start() # 启动线程 self._thread.start() # 启动线程
QTimer.singleShot(1, self._worker.run)
def closeEvent(self, event): def closeEvent(self, event):
if self._thread.isRunning(): if self._thread.isRunning():