April 2018
Beginner
714 pages
18h 21m
English
Use Qt Creator to create a new Qt Widgets project and name it sine_graph. On the Class Information page of the wizard, select QWidget as the base class and input View as the class name. Uncheck the Generate form checkbox and finish the wizard.
We want the View class to be the graphics view, so you need to change the base class to QGraphicsView (the wizard doesn't suggest such an option). For this, edit the class declaration to look like class View : public QGraphicsView ... and the constructor implementation to look like View::View(QWidget *parent) : QGraphicsView(parent) ....
Next, edit the View constructor to enable anti-aliasing and set a new graphics scene for our view:
setRenderHint(QPainter::Antialiasing); ...
Read now
Unlock full access