QIODevice::readyRead()
void QIODevice::readyRead() This signal is emitted once every time new data is available for reading from the device(每次当新数据可读时,就会发射该信号.看有文章说和写并不一一对应,有可能写一次,需要读多次,也可能写多次,只读一次). It will only be emitted again once new data is available, such as when a new payload of network data has arrived on your network socket, or when a new block of data has been appended to your device.
readyRead() is not emitted recursively(非递归,如果嵌套调用,则不会再触发); if you reenter the event loop or call waitForReadyRead() inside a slot connected to the readyRead() signal, the signal will not be reemitted (although waitForReadyRead() may still return true).
Note for developers implementing classes derived from QIODevice: you should always emit readyRead() when new data has arrived(继承自QIODevice,需要在新数据到达的时候去手动emit readyRead() 信号) (do not emit it only because there’s data still to be read in your buffers). Do not emit readyRead() in other conditions.