The focus of this recipe is to understand how the data entered by the user is assigned to the class variable, and how the message displayed can be accessed via class methods. Let's create a new application based on the Dialog without Buttons template and follow these steps:
- Drag and drop two Label widgets, one Line Edit, and one Push Button widget onto the form.
- Set the text property of the first Label widget to Enter your name.
Let's not change the text property of the second Label widget and keep its text property to its default value of TextLabel. This is because its text property will be set through code to display the hello message.
- Set the text property of the Push Button widget to Click.
- Set the objectName property ...