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 – Adding widgets to the form

Locate the Label item in the toolbox (it's in the Display Widgets category) and drag it to our form. Use the property editor to set the objectName property of the label to player1Name. objectName is a unique identifier of a form item. The object name is used as the name of the public field in the Ui::MainWindow class, so the label will be available as ui->player1Name in the MainWindow class (and will have a QLabel * type). Then, locate the text property in the property editor (it will be in the QLabel group, as it is the class that introduces the property) and set it to Player 1. You will see that the text in the central area will be updated accordingly. Add another label, set its objectName to ...

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