Chapter 14: Validation and Regular Expressions

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. String data often must have a certain format. Validation of input data is an important issue that can be handled in an object-oriented way by a combination of Qt classes. This chapter discusses some efficient ways of validating input, including the use of regular expressions.

Validators and input masks give the developer fine-grained control over behavior of a QLineEdit, for the purpose of restricting certain kinds of inputs. Before working with them, keep in mind that Qt also offers predefined input widgets and input dialogs for many common value ...

Get Introduction to Design Patterns in C++ with Qt, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.