Chapter 13. Validation and Regular Expressions

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.

13.1

Validators

308

13.2

Regular Expressions

310

13.3

Regular Expression Validation

316

Validators

Validators are nonvisual objects that are attached to input widgets (such as QLineEdit, QSpinBox, and QComboBox) to provide a general framework for checking user input. Qt has an abstract class named QValidator that establishes the interface for all built-in and custom validators.

There are two concrete subclasses that can be used for numeric range checking: QIntValidator and QDoubleValidator ...

Get An Introduction to Design Patterns in C++ with Qt 4 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.