The example code for QPoint::dotProduct() and QPointF::dotProduct() is as follows:
The name "lengthSquared" is definitively wrong. In this special case, the result (25) is actually the squared distance between the two points. But in generic cases, dotProduct() returns the dot product of the two points interpreted as 2-element vectors.
The dot product of two 2-element vectors is defined as follows (source code of QPointF::dotProduct()):
As easily seen, the result is negative in 50% of all cases. This can not be a squared distance.
The dot product's most popular property is that it is equal to zero if the two vectors are perpendicular. So I suggest to replace the example code by the following:
Or simply by this: