Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
What just happened?
First, we added an import statement to make the QtQuick.Controls module available in the current scope. If you're not sure which version to use, invoke Qt Creator's code completion and use the most recent version. Due to the new import, we can now use the TextField and Label QML types in our QML file.
Next, we declared two children of the top-level Window object. QML objects form a parent-child relationship, much like QObject in C++. However, you don't need to explicitly assign parents to items. Instead, you declare the object within the declaration of its parent, and QML will automatically ensure that relationship. In our example, the TextField { ... } part tells QML to create a new QML object of the TextField type.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access