1 #ifndef FACT_SpinBox4ns 2 #define FACT_SpinBox4ns 13 QValidator::State
validate(QString &input,
int &p)
const 15 const QValidator::State rc = QSpinBox::validate(input, p);
16 if (rc!=QValidator::Acceptable)
19 const int pf = prefix().length();
20 const int sf = suffix().length();
21 const int len = input.length();
23 return input.mid(pf, len-sf-pf).toUInt()%4==0 ? QValidator::Acceptable : QValidator::Intermediate;
26 void fixup(QString &input)
const 28 const int pf = prefix().length();
29 const int sf = suffix().length();
30 const int len = input.length();
32 const uint
i = input.mid(pf, len-pf-sf).toUInt()+2;
33 input = QString::number((i/4)*4);
A QSpinBox which only accepts values dividable by 4.
void fixup(QString &input) const
QValidator::State validate(QString &input, int &p) const