From e0737c56c1e384e05064a0c6e1ac46979371041b Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 19 Dec 2018 22:58:32 +0100 Subject: New upstream version 2.0.0+repack --- widgets/RestrictedSpinBox.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 widgets/RestrictedSpinBox.cpp (limited to 'widgets/RestrictedSpinBox.cpp') diff --git a/widgets/RestrictedSpinBox.cpp b/widgets/RestrictedSpinBox.cpp new file mode 100644 index 00000000..d3201b33 --- /dev/null +++ b/widgets/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