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

Restricting access to C++ classes from JavaScript

There are cases when you want to provide a rich interface for a class to manipulate it from within C++ easily, but to have strict control over what can be done using scripting, you want to prevent scripters from using some of the properties or methods of the class.

The safest approach is to create a wrapper class that only exposes the allowed methods and signals. This will allow you to design your original classes freely. For example, if you want to hide some methods, it's quite easy—just don't make them slots and don't declare them with Q_INVOKABLE. However, you may want them to be slots in the internal implementation. By creating a wrapper class, you can easily hide slots of the internal ...

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