Set the error in the same method where the check against failure is done

This is done for consistency with other QIODevice subclasses, like in QtNetwork.
It also makes the code shorter due to the eliminated unnecessary Q_Q macro
usage.

Change-Id: Ibbd2be08e7aeff2bd0687d542cb256efb05f59bc
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>