diff options
Diffstat (limited to 'widgets/RestrictedSpinBox.cpp')
| -rw-r--r-- | widgets/RestrictedSpinBox.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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 ()); + } +} |
