mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 13:41:16 +01:00
21 lines
359 B
C++
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;
|
|
}
|