From 37f727ac0746fd85504aa46c1f023c09b3eff33a Mon Sep 17 00:00:00 2001 From: hibby Date: Fri, 16 Feb 2018 15:17:14 +0000 Subject: New upstream version 1.8.0+repack --- RestrictedSpinBox.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 RestrictedSpinBox.cpp (limited to 'RestrictedSpinBox.cpp') diff --git a/RestrictedSpinBox.cpp b/RestrictedSpinBox.cpp new file mode 100644 index 00000000..d3201b33 --- /dev/null +++ b/RestrictedSpinBox.cpp @@ -0,0 +1,19 @@ +#include "RestrictedSpinBox.hpp" + +#include +#include + +#include + +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; +} -- cgit v1.2.3