Graphics View framework
The Graphics View framework is part of the widgets module in Qt so it is already supported by default, unless you're running Qt console application instead, which does not need the widgets module.
The Graphics View view in Qt works pretty much like a whiteboard, where you can draw anything on it using C/C++ code, such as drawing shapes, lines, text, and even images. This chapter may be a little hard to follow for beginners but it will definitely be a fun project to work with. Let's get started!
Setting up a new project
First, create a new Qt Widgets Application
project. After that, open mainwindow.ui
and drag and drop theGraphics View
widget onto the main window, like this:

Then, create a layout for the graphics view by clicking on the Lay Out Vertically
button at the top of the canvas. After that, open up mainwindow.h
and add the following headers and variables:
#include <QGraphicsScene>
#include <QGraphicsRectItem>
#include <QGraphicsEllipseItem>
...