QPainter and 2D Graphics
In this chapter, we will learn how to render 2D graphics on screen with Qt. Internally, Qt uses a low-level class called QPainter
to render its widgets on the main window. Qt allows us to access and use the QPainter
class for drawing vector graphics, text, 2D images, and even 3D graphics.
You can make use of the QPainter
class to create your own custom widgets or to create programs that rely heavily on rendering computer graphics such as video games, photo editors, and 3D modeling tools.
In this chapter, we’re going to cover the following main topics:
- Drawing basic shapes on the screen
- Exporting shapes to Scalable Vector Graphics (SVG) files
- Coordinate transformation
- Displaying images on screen
- Applying image effects to graphics
- Creating a basic paint program
- Rendering a 2D canvas in QML