O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – Editing QML

Let's add some content to our window. Edit the main.qml file with the following code:

import QtQuick 2.9import QtQuick.Window 2.2import QtQuick.Controls 2.2Window {    visible: true    width: 640    height: 480    title: qsTr("Hello World")    TextField {        text: "Edit me"        anchors {            top: parent.top            left: parent.left        }    }    Label {        text: "Hello world"        anchors {            bottom: parent.bottom            left: parent.left        }    }}

When you run the project, you will see a text field and a label in the window:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required