Use the qstring toint () function with caution:
We are used to using the encapsulated functions provided by QT programming, but this requires extra attention. For the use of toint (A, 10) when a of the qstring type is converted to a decimal number, a can only contain 0-9 characters. If it contains other characters, the output is 0, leading to incorrect final result, it is also similar to 16 prohibitions. Then, if the data of the lower machine is received through the serial port, it will be troublesome to process the data types transmitted between the lower machine, for example, the data of the uchar type that may be transmitted by the lower computer may be ffffffffff22. In fact, it is only valid for 22. In this case, on the PC side, we need to perform the & 0xff operation on the received data that exceeds 0xff, or the lower computer will perform the & 0xff operation before transmission.
Use qstring toint () function with caution