QPainter painter(this); QPolygonF polygon; polygon << QPointF(10, 10) << QPointF(100, 10) << QPointF(70, 70) << QPointF(10, 100); painter.drawConvexPolygon(polygon);In this example code, we first create a QPainter instance by passing the reference of the widget to the constructor. We then create a QPointF instance for each vertex of the polygon and add them to the QPolygonF in consequtive order. Lastly, we call the drawConvexPolygon function with a reference to our polygon. This code draws a convex polygon that is defined by 4 points on the widget. The first point is (10, 10), the second is (100, 10), the third is (70, 70) and the fourth is (10, 100). The package library being used here is the Qt framework. We need to include the necessary headers and libraries for the project to compile and link correctly.