summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qdial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qdial.cpp')
-rw-r--r--src/gui/widgets/qdial.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/widgets/qdial.cpp b/src/gui/widgets/qdial.cpp
index 86981e0..19e8d23 100644
--- a/src/gui/widgets/qdial.cpp
+++ b/src/gui/widgets/qdial.cpp
@@ -83,6 +83,7 @@ public:
int valueFromPoint(const QPoint &) const;
double angle(const QPoint &, const QPoint &) const;
void init();
+ virtual int bound(int val) const;
};
void QDialPrivate::init()
@@ -97,6 +98,20 @@ void QDialPrivate::init()
#endif
}
+int QDialPrivate::bound(int val) const
+{
+ if (wrapping) {
+ if ((val >= minimum) && (val <= maximum))
+ return val;
+ val = minimum + ((val - minimum) % (maximum - minimum));
+ if (val < minimum)
+ val += maximum - minimum;
+ return val;
+ } else {
+ return QAbstractSliderPrivate::bound(val);
+ }
+}
+
/*!
Initialize \a option with the values from this QDial. This method
is useful for subclasses when they need a QStyleOptionSlider, but don't want