Fix reading when switching from asynchronous to synchronous approach


If one wants to use the asynchronous approach (using the signals and
slots), and then - the synchronous (using the waitForXX functions) then
synchronous reading stalls because the waitForReadyRead() method
always returns the TimeoutError code.

The reason is that the signal readyRead() is emitted before the
startAsyncRead() (or the startAsyncCommunication()) called inside of
completeAsyncRead().

Need to emit the readyRead() only after the next asynchronous reading
(the startAsyncRead() or the startAsyncCommunication()) was cocked.

Now the behavior is similar to behavior of QWindowsPipeReader. Besides,
the auto-test which reveals this issue is added.

Tested with the virtual com0com serial ports, using the auto-tests and
set of the examples.

Change-Id: I64bfb871d17c179f474d6672546e532566913a7f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Andrzej Ostruszka <andrzej.ostruszka@gmail.com>
commitb32740001f735be9f0938f85d325dc2cf3dbe598
parent77c48a0e22c1048226832e6b845d72da9d5b317f
authorDenis Shienkov <denis.shienkov@gmail.com>
committerDenis Shienkov <denis.shienkov@gmail.com>
commit timeTue, 7 Jul 2015 14:00:58 +0000