diff options
| author | Christoph Berg <christoph.berg@credativ.de> | 2019-07-17 15:12:32 +0200 |
|---|---|---|
| committer | Christoph Berg <christoph.berg@credativ.de> | 2019-07-17 15:12:32 +0200 |
| commit | 3d67be3023bf34eac7f93fa422f5ef569abb92a9 (patch) | |
| tree | f3748d6a113c50d483882b60b732a9d211100cf8 /widgets/RestrictedSpinBox.cpp | |
| parent | 62c0c627f4f8aec46a082bf098d4f1523a16d297 (diff) | |
New upstream version 2.1.0+repackupstream/2.1.0+repack
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 ()); + } +} |
