O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – Creating a graphics item class

Ask Qt Creator to add a new C++ class to the project. Input SineItem as the class name, leave <Custom> in the Base class drop-down list, and input QGraphicsItem in the field below it. Finish the wizard and open the created sineitem.h file.

Set the text cursor inside QGraphicsItem in the class declaration and press Alt + Enter. At first; Qt Creator will suggest that you Add #include <QGraphicsItem>. Confirm that and press Alt + Enter on QGraphicsItem again. Now, Qt Creator should suggest that you select Insert Virtual Functions of Base Classes. When you select this option, a special dialog will appear:

The function list contains all virtual functions of the base class. The pure virtual functions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required