QPolygonF poly; poly << QPointF(0, 0) << QPointF(50, 0) << QPointF(50, 50) << QPointF(0, 50); QPainter painter(this); painter.drawPolygon(poly);
QPolygonF poly; poly << QPointF(0, 0) << QPointF(50, 0) << QPointF(50, 50) << QPointF(0, 50); QPointF point(25, 25); if (poly.containsPoint(point, Qt::OddEvenFill)) { // point is inside polygon } else { // point is outside polygon }In both examples, the ``QPolygonF`` class is used to represent a polygon with the help of the ``QPointF`` class for defining its points. These examples are part of the Qt library, particularly the QtGui module.