
ShapeComboBox - >addItem(tr( "Polygon"), RenderArea ::Polygon) In the constructor we create and initialize the various widgets appearing in the main application window. And the brushChanged() slot updates the RenderArea widget when the user changes the painter's brush style. We call the penChanged() slot when either of the QPainter's pen parameters changes. We declare the various widgets, and three private slots updating the RenderArea widget: The shapeChanged() slot updates the RenderArea widget when the user changes the currently active shape. The Window class inherits QWidget, and is the application's main window displaying a RenderArea widget in addition to several parameter widgets.

The example provides a render area, displaying the currently active shape, and lets the user manipulate the rendered shape and its appearance using the QPainter parameters: The user can change the active shape ( Shape), and modify the QPainter's pen ( Pen Width, Pen Style, Pen Cap, Pen Join), brush ( Brush Style) and render hints ( Antialiasing). Normally, it draws in a "natural" coordinate system, but it can in addition do view and world transformation. It can also draw aligned text and pixmaps.

The class can draw everything from simple lines to complex shapes like pies and chords. QPainter performs low-level painting on widgets and other paint devices.
