OGS
StrictIntValidator Class Reference

Detailed Description

A validator for an input field which only accepts integers. Source code adapted from Qt developer faq: https://web.archive.org/web/20100702180529/http://developer.qt.nokia.com/faq/answer/i_can_still_insert_numbers_outside_the_range_specified_with_a_qdoublevalida.

Definition at line 13 of file StrictIntValidator.h.

#include <StrictIntValidator.h>

Inheritance diagram for StrictIntValidator:
[legend]
Collaboration diagram for StrictIntValidator:
[legend]

Public Member Functions

 StrictIntValidator (int min, int max, QObject *parent=nullptr)
QValidator::State validate (QString &input, int &pos) const override

Constructor & Destructor Documentation

◆ StrictIntValidator()

StrictIntValidator::StrictIntValidator ( int min,
int max,
QObject * parent = nullptr )
inline

Definition at line 16 of file StrictIntValidator.h.

17 : QIntValidator(min, max, parent)
18 {
19 }

Member Function Documentation

◆ validate()

QValidator::State StrictIntValidator::validate ( QString & input,
int & pos ) const
inlineoverride

Definition at line 21 of file StrictIntValidator.h.

22 {
23 if (input.isEmpty())
24 return Intermediate;
25
26 if (QIntValidator::validate(input, pos) != Acceptable)
27 return Invalid;
28 return Acceptable;
29 }

The documentation for this class was generated from the following file: