Our new project is so simple that all its code is located in the main() function. Let's examine the code. First, we create a QApplication object, as in any Qt Widgets project. Next, we create a scene object and three instances of different item classes. The constructor of each item class accepts an argument that defines the content of the item:
- The QGraphicsRectItem constructor receives a QRectF object that contains the coordinates of the rectangle
- The QGraphicsEllipseItem constructor, similarly, receives a QRectF object that defines the bounding rectangle of the circle
- The QGraphicsSimpleTextItem constructor receives the text to display