Using the input dialog
The input dialog can accept data of any type, including integer, double, and text. In this recipe, we will learn to get text from the user. We will make use of an input dialog to know the name of the country in which the user lives.
The input dialog box will display a combo box showing different country names. On choosing a country by name, the chosen country name will appear in the textbox.
How to do it...
Let's create a new application based on the Dialog without Buttons
template by performing the following steps:
- Since the application will prompt the user to choose the country that he/she lives, via input dialog, so drag and drop one
Label
widget, oneLine Edit
widget, and onePush Button
widget onto the form. - Set the
text
property of theLabel
widget toYour Country
. - Set the
text
property of thePush Button
widget toChoose Country
. - Set the
objectName
property of theLine Edit
widget tolineEditCountry
. - Set the
objectName
property of thePush Button
widget topushButtonCountry...