Qt Modeling Language (QML) is a hierarchical declarative language for user interface layout with a syntax similar to JavaScript Object Notation (JSON). It can bind to C++ objects via Qt’s meta object system and also supports inline JavaScript. It’s much like HTML or XAML but without the XMLness. If you are someone who likes JSON more than XML, this can only be a good thing!

Go ahead and open up MasterView.qml, and we’ll see what’s going on.

The first thing you’ll see is a couple of import statements. They are similar to #include statements in C++—they bring in pieces of functionality that we want to use in the view. They can be packed and versioned modules as with QtQuick 2.9, or they can be relative paths to local content.

Next, the ...

Get End to End GUI Development with Qt5 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.