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 – Hiding properties

If we convert our heartbeat canvas to a QML component, the points and arg properties will be the public properties visible to the user of the component. However, they are really implementation details we want to hide. We should only expose properties that make sense to the user of the component, such as lineWidth or color.

Since the Timer object inside the Canvas is not exported as public property, that timer object will be unavailable from the outside, so we can attach properties to the timer instead of attaching them to the top-level Canvas object. However, the properties do not belong to the timer logically, so this solution will be confusing. For such cases, there is a convention that you should create ...

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