#include "integervalidator.h"

#include <QRegularExpression>

IntegerValidator::IntegerValidator(QObject *parent) : QValidator(parent) {
  m_expression.setPattern("^[0-9]*$");
}

QValidator::State IntegerValidator::validate(QString &string, int &pos) const {
  Q_UNUSED(pos);
  if (m_expression.match(string).hasMatch())
    return Acceptable;
  return Invalid;
}
