// Create a point at (3, 4.5) QPointF point(3, 4.5); // Get the x and y coordinates of the point qreal x = point.x(); qreal y = point.y();
// Create two points and calculate the distance between them QPointF p1(1, 2); QPointF p2(4, 6); qreal distance = QLineF(p1, p2).length();This example creates two QPointF objects and calculates the distance between them using the QLineF class. This is done by creating a QLineF object with the two points, and then calling the length() function to get the distance between them. Package/Library: Qt