4
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 ...
Get Qt 6 C++ GUI Programming Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.