Time for action – Self-updating car dashboard

We will start with the C++ part. Set up a new Qt Quick application. This will generate the main function for you that instantiates QGuiApplication and QQmlApplicationEngine and sets them up to load a QML document.

Use the File menu to create New file or Project and create a new Qt Designer form class. Call it CarInfo and choose the Widget template. We will use this class for modifying values of different parameters so that we may observe how they influence what the Qt Quick scene displays. In the class declaration, add the following properties:

class CarInfo : public QWidget { Q_OBJECT Q_PROPERTY(int rpm READ rpm NOTIFY rpmChanged) Q_PROPERTY(int gear READ gear NOTIFY gearChanged) Q_PROPERTY(int ...

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.