Time for action – Grouping engine properties

The data interface between the QML and C++ worlds that we created is very simple and has a small number of properties. However, as the amount of data we want to expose grows, the object can become cluttered. Of course, we can counter that effect by dividing it into multiple smaller objects, each having separate responsibilities and then exporting all those objects to QML, but that is not always desirable. In our case, we can see that rpm and gear are properties of the engine subsystem, so we can move them to a separate object; however, in reality, their values are tightly coupled with the speed of the car and to calculate the speed, we will need to know the values of those two parameters. However, ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.