1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00
GPXSee/src/GUI/oddspinbox.cpp

21 lines
359 B
C++

#include "oddspinbox.h"
OddSpinBox::OddSpinBox(QWidget *parent) : QSpinBox(parent)
{
setSingleStep(2);
setMinimum(1);
}
QValidator::State OddSpinBox::validate(QString &text, int &pos) const
{
Q_UNUSED(pos);
bool ok;
int val;
val = text.toInt(&ok);
if (!ok || val < 0 || val % 2 == 0)
return QValidator::Invalid;
return QValidator::Acceptable;
}