js8call/.svn/pristine/2c/2cfad3fc19b7f1676117d1dbf39bdbb3edcaeb03.svn-base
2018-02-08 21:28:33 -05:00

20 lines
505 B
Plaintext

#include "RestrictedSpinBox.hpp"
#include <algorithm>
#include <utility>
#include <QString>
QValidator::State RestrictedSpinBox::validate (QString& input, int& pos) const
{
// start by doing the standard QSpinBox validation
auto valid = HintedSpinBox::validate (input, pos);
// extra validation
if (QValidator::Acceptable
&& values ().end () == std::find (values ().begin (), values ().end (), valueFromText (input)))
{
valid = QValidator::Intermediate;
}
return valid;
}