Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
5.15.0
-
None
-
Windows 10, PySide2 5.15.0, Python 3.7.8. Pyside installed via pip.
Description
A QProgressDialog updated by a QThread via signals will often jam if the updates are emitted relatively frequently (5-10 times a second). The QProgressDialog will stop updating and stick on one value. If this happens, it will remain jammed for some time after the thread has finished its work. It will eventually come back to life and close properly.
This issue is unpredictable. It will jam at different points each time and occasionally it will make it through without stopping. If I do not set the QProgressBar modality to WindowModal, it works without issue.
The issue does not appear to exist in Pyside2 5.14.2.3.
This is a minimal example:
from PySide2 import QtWidgets, QtCore import time import sys class SomeWidget(QtWidgets.QWidget): def __init__(self, parent=None): super(SomeWidget, self).__init__(parent) self.thread = QtCore.QThread() self.progress = QtWidgets.QProgressDialog("", "Cancel", 0, 100, self) self.progress.setWindowModality(QtCore.Qt.WindowModal) self.progress.setAutoClose(True) self.progress.setAutoReset(True) self.worker = Worker() self.worker.moveToThread(self.thread) self.worker.update_progress.connect(self.progress.setValue) self.worker.done.connect(self.work_done) self.thread.started.connect(self.worker.do_the_thing) self.thread.start() def work_done(self): self.thread.exit() print("Done") class Worker(QtCore.QObject): update_progress = QtCore.Signal(int) done = QtCore.Signal() def do_the_thing(self): for ii in range(1, 101): time.sleep(0.1) # Simulate work self.update_progress.emit(ii) self.done.emit() app = QtWidgets.QApplication() widget = SomeWidget() widget.show() sys.exit(app.exec_())