QPointF point1(10.5, 20.0); QPointF point2(5.2, 30.0); QPointF result = point1 + point2;
QPointF point1(10.5, 20.0); QPointF point2(5.2, 30.0); qreal distance = QLineF(point1, point2).length();In this example, the QLineF class is used to calculate the distance between two points represented by QPointF objects. The distance is stored in a qreal variable called distance. These examples use the Qt package library, which provides a wide range of classes for building graphical user interfaces and multimedia applications.