summaryrefslogtreecommitdiff
path: root/widgets/RestrictedSpinBox.cpp
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2019-07-17 15:14:42 +0200
committerChristoph Berg <christoph.berg@credativ.de>2019-07-17 15:14:42 +0200
commit05f825a1959653728acc38a844b41ec8b1622374 (patch)
tree264ebe54e977337d0faf0a093a117eb2665b14ac /widgets/RestrictedSpinBox.cpp
parent77521f03e135e9b6c1f6732d749db6b541c8dfac (diff)
parent3d67be3023bf34eac7f93fa422f5ef569abb92a9 (diff)
Update upstream source from tag 'upstream/2.1.0+repack'
Update to upstream version '2.1.0+repack' with Debian dir f1034457a9a3db00e6d9c4d0a89a0de3d3134010
Diffstat (limited to 'widgets/RestrictedSpinBox.cpp')
-rw-r--r--widgets/RestrictedSpinBox.cpp14
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 ());
+ }
+}