How it works...
In this application, you are using Graphics View to display an image. You add a graphics scene to the Graphics View widget, and you add QGraphicsPixmapItem. If you want to add an image to the graphics scene, you need to provide it in the form of a pixmap item. First, you need to represent the image as pixmap, and then you make it appear as a pixmap item before adding it to the graphics scene. You need to create an instance of QPixmap and specify the image that you want to display through its load() method. Then, you tag the pixmap item as pixmapitem by passing pixmap to the constructor of QGraphicsPixmapItem. pixmapitem is then added to the scene via addItem. If pixmapitem is bigger than QGraphicsView, scrolling is enabled ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access