Qt validating user input
This chapter discusses some efficient ways of validating input, including the use of regular expressions.
Text validation can help the user to understand what information is required when entering data into a form.
The line edits are stored in the window for use in these slots.
The The slot either creates a new validator for the line edit to use, or it removes the validator in use by calling QLine Edit::set Validator() with a zero pointer.
Abstract Input data generally needs to be screened, or validated, to make sure that it is appropriate.
Numeric data generally needs to be within certain ranges. Validation of input data is an important issue that can be handled in an object-oriented way by a combination of Qt classes.
The official documentation of Qt's REs is huge and great.
If there is an invalid field, instead of continuing with the process (resulting in an error later), the GUI can direct the user to the invalid field.
One surprising fact about users is that they always seem to type in inputs the developer did not expect.
The Line Edits example demonstrates the many ways that QLine Edit can be used, and shows the effects of various properties and validators on the input and output supplied by the user.
The example consists of a single class, containing a selection of line edits with different input constraints and display properties that can be changed by selecting items from comboboxes.