Introducing QML

QML (Qt Modeling Language) is a user-interface markup language for designing touch-friendly user interfaces, similar to how CSS works on HTML. Unlike C++ or JavaScript, which are both imperative languages, QML is a declarative language. In declarative programming, you only express the logic in your script without describing its control flow. It simply tells the computer what to do, instead of how to do it. Imperative programing, however, requires statements to specify actions.

When you open up your newly created Qt Quick project, you will see main.qml and MainForm.ui.qml in your project, instead of the usual mainwindow.h and mainwindow.cpp files. You can see this in the project directory in the following screenshot:

This ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.