blob: d3201b331a088a8296de5d61ae7b87809e6f95a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#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;
}
|