上QQ阅读APP看书,第一时间看更新
Custom 2D Graphics with Graphics View
Widgets are great for designing graphical user interfaces, but they are not convenient if you want to use multiple objects with custom painting and behavior together, such as in a 2D game. You will also run into problems if you wish to animate multiple widgets at the same time, by constantly moving them around in the application. For these situations, or generally for frequently transforming 2D graphics, Qt offers you Graphics View. In this chapter, you will learn the basics of the Graphics View architecture and its items. You will also learn how to combine widgets with Graphics View items.
The main topics covered in this chapter are as follows:
- Graphics View architecture
- Coordinate systems
- Standard graphics items
- Pens and brushes
- Useful features of Graphics View
- Creating custom items
- Event handling
- Embedding widgets in the view
- Optimizations