Graphics View architecture

The Graphics View Framework is part of the Qt Widgets module and provides a higher level of abstraction useful for custom 2D graphics. It uses software rendering by default, but it is very optimized and extremely convenient to use. Three components form the core of Graphics View, as shown:

  • An instance of QGraphicsView, which is referred to as View
  • An instance of QGraphicsScene, which is referred to as Scene
  • Instances of QGraphicsItem, which are referred to as Items

The usual workflow is to first create a couple of items, add them to a scene, and then show that scene on a view:

After that, you can manipulate items ...

Get Game Programming using Qt 5 Beginner's Guide - Second 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.