QGraphicsView and QGraphicsScene
Description of widgets for visualizing 2D data (images etc.)QGraphicsView is a class that offers a widget for visualizing QGraphicsScene objects - surfaces with lot of 2D elements. Scene can contain various elements (added with addEllipse(), addLine(), addPath(), addPixmap(), addPolygon(), addRect() or addText()) and display them in given way. Here is an example of displaying an image: Scenes can also be rendered with OpenGL, which is handy and efficient for images and multimedia processing. To use OpenGL only one line of code is needed: The result will be the same: QGraphicsView and QGraphicsScene have a lot of features. For example if we want to scale the image to the window size we can use events: We made our own class that inherits QGraphicsView, so we can use resizeEvent event. The event object is QResizeEvent, which has the current size of the scene. When we have the size we can scale the pixmap to that size and update the pixmap used by the scene.