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 – Assigning an expression to the property

As you already saw, assigning constant text to a label is easy. However, you can also assign a dynamic expression to any property in the form editor. To do that, select the result label and mouse over the circle in the left part of Text property input field. When the circle turns into an arrow, click on it and select Set Binding in the menu. Input argument1.text + argument2.text in the binding editor and confirm the change.

If you run the application now, you will see that the result label will always display the concatenation of the strings the user inputs in the fields. That's because the argument1.text and argument2.text properties have the string type, so the + operation performs ...

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