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

Have a go hero – Extending the item's functionality

The abilities of SineItem are still pretty limited. As an exercise, you can try to add an option to change the minimum x value of the graph or set a different pen. You can even allow the user to specify an arbitrary function pointer to replace the sin() function. However, keep in mind that the bounding rect of the item depends on the value range of the function, so you need to update the item's geometry accurately.

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