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 24 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 27 of file StrictIntValidator.h.

28  : QIntValidator(min, max, parent)
29  {
30  }

Member Function Documentation

◆ validate()

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

Definition at line 32 of file StrictIntValidator.h.

33  {
34  if (input.isEmpty())
35  return Intermediate;
36 
37  if (QIntValidator::validate(input, pos) != Acceptable)
38  return Invalid;
39  return Acceptable;
40  }

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