From 3d67be3023bf34eac7f93fa422f5ef569abb92a9 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 17 Jul 2019 15:12:32 +0200 Subject: New upstream version 2.1.0+repack --- widgets/RestrictedSpinBox.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'widgets/RestrictedSpinBox.cpp') diff --git a/widgets/RestrictedSpinBox.cpp b/widgets/RestrictedSpinBox.cpp index d3201b33..3d18ce48 100644 --- a/widgets/RestrictedSpinBox.cpp +++ b/widgets/RestrictedSpinBox.cpp @@ -17,3 +17,17 @@ QValidator::State RestrictedSpinBox::validate (QString& input, int& pos) const } return valid; } + +void RestrictedSpinBox::fixup (QString& input) const +{ + auto iter = std::lower_bound (values ().begin (), values ().end (), valueFromText (input)); + HintedSpinBox::fixup (input); + if (iter != values ().end ()) + { + input = textFromValue (*iter); + } + else + { + input = textFromValue (values ().back ()); + } +} -- cgit v1.2.3