QPolygonF polygon; polygon << QPointF(0, 0) << QPointF(30,80) << QPointF(80, 30) << QPointF(140, 120); int size = polygon.size();
QPolygonF polygon; polygon << QPointF(2, 3) << QPointF(-4, 0) << QPointF(1, 8) << QPointF(-3, -1) << QPointF(2, 3); int size = polygon.size();This example creates a new instance of QPolygonF and adds five points to it. The polygon is a closed shape as the last point is the same as the first point. The size() function is then called, which returns the integer value 5 indicating there are 5 points in the polygon. Package library: Qt.