summaryrefslogtreecommitdiff
path: root/HintedSpinBox.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /HintedSpinBox.cpp
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'HintedSpinBox.cpp')
-rw-r--r--HintedSpinBox.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/HintedSpinBox.cpp b/HintedSpinBox.cpp
deleted file mode 100644
index 25ffcc71..00000000
--- a/HintedSpinBox.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "HintedSpinBox.hpp"
-
-#include <algorithm>
-
-auto HintedSpinBox::values (values_type values, bool set_min_max) -> values_type
-{
- // replace any prior values
- std::swap (values, values_);
-
- // sort values and make unique
- std::sort (values_.begin (), values_.end ());
- auto last = std::unique (values_.begin (), values_.end ());
- values_.erase (last, values_.end ());
- if (set_min_max)
- {
- setMinimum (values_.front ());
- setMaximum (values_.back ());
- }
- return values; // return old values
-}
-
-void HintedSpinBox::stepBy (int steps)
-{
- if (values_.size ())
- {
- if (steps > 0)
- {
- auto p = std::upper_bound (values_.begin (), values_.end (), value ());
- if (p != values_.end () && *p <= maximum ())
- {
- setValue (*p);
- }
- else if (wrapping ())
- {
- setValue (values_.front ());
- }
- }
- else if (steps < 0)
- {
- auto p = std::lower_bound (values_.begin (), values_.end (), value ());
- if (p != values_.begin () && *(p - 1) >= minimum ())
- {
- setValue (*(p - 1));
- }
- else if (wrapping ())
- {
- setValue (values_.back ());
- }
- }
- }
- else
- {
- QSpinBox::stepBy (steps); // no values so revert to QSpinBox behaviour
- }
-}