Docs: improve the example of reading from port


QSerialPort is derived from QIODevice, and QIODevice::read() has always
returned qint64, not int.
So, update the type of the numRead and numReadTotal variables.

As a drive-by, move the numRead variable inside the loop, because
pre-declaring it is actually a bad practice in modern C++. This
also allows to make it const.

Fixes: QTBUG-109455
Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Ie1f28213aae61e6df4fc3a80a274aafae8156e16
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
commit4fb5799ad83228edb6f9f89b18de2708cdca4a3c
parentadb03af5e9ccefc7f7562ed16bee2823263a7002
authorIvan Solovev <ivan.solovev@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeMon, 11 Nov 2024 14:49:45 +0000