QPointF point1(0, 0); QPointF point2(10, 10); QLineF line(point1, point2);
QPointF point1(0, 0); QPointF point2(10, 10); QLineF line(point1, point2); qreal length = line.length();This code creates a QLineF object with two points (0,0) and (10,10) as its endpoints and then calculates its length. Package library: Qt(GUI)