Python QSerialPort readyRead信号仅在应用程序被waitForReadyRead()阻止时发出

Python QSerialPort readyRead信号仅在应用程序被waitForReadyRead()阻止时发出,python,pyqt,pyqt5,qtserialport,Python,Pyqt,Pyqt5,Qtserialport,我正在编写使用PyQT5从串行端口读取数据的简单应用程序,但从串行端口接收数据时不会发出readyRead 如果应用程序被waitForReadyRead()阻止,则在接收数据时调用dataReady() 将Windows 10与Python 3.7.4、PyQt5 5.13.1一起使用 再现问题的最小代码: from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget from PyQt5.QtWidgets import QMa

我正在编写使用PyQT5从串行端口读取数据的简单应用程序,但从串行端口接收数据时不会发出
readyRead

如果应用程序被
waitForReadyRead()
阻止,则在接收数据时调用
dataReady()

将Windows 10与Python 3.7.4、PyQt5 5.13.1一起使用

再现问题的最小代码:

from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget
from PyQt5.QtWidgets import QMainWindow, QLabel
from PyQt5.QtCore import Qt, QIODevice
from PyQt5.QtSerialPort import QSerialPort
import sys


class ExampleGUI(QMainWindow):
    def __init__(self):
        super().__init__()

        #self.setGeometry(50,50,500,300)
        self.setWindowTitle("Example")

        # Start mainLayout
        self.mainLayout = QVBoxLayout()

        serialLabel = QLabel("Example program")
        self.mainLayout.addWidget(serialLabel)

        widget = QWidget()
        widget.setLayout(self.mainLayout)
        self.setCentralWidget(widget)

        self.serPort = QSerialPort()
        self.serPort.readyRead.connect(self.dataReady)
        self.serPort.setPortName("COM4")
        self.serPort.setBaudRate(9600)
        self.serPort.open(QIODevice.ReadWrite)
        self.serPort.writeData("Hi".encode())
        # self.serPort.waitForReadyRead()

    def dataReady(self):
        print(bytes(self.serPort.readAll()))


if __name__ == '__main__':
    app = QApplication([])
    gui = ExampleGUI()
    gui.show()
    app.exec_()

似乎它是Qt中的bug。使用旧版本5.13.0解决了这个问题