From c9aa1d76a6c358ba39483c7068142d4885f5d7fe Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 6 Aug 2014 17:43:50 +0100 Subject: [PATCH] Fix param bounds in bulti-in editor --- source/widgets/paramspinbox.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/widgets/paramspinbox.py b/source/widgets/paramspinbox.py index a92f01a7e..62ad3ec68 100644 --- a/source/widgets/paramspinbox.py +++ b/source/widgets/paramspinbox.py @@ -418,8 +418,18 @@ class ParamSpinBox(QAbstractSpinBox): if self.fIsReadOnly: return - step = int((value - self.fMinimum) / self.fStep + 0.5) - realValue = self.fMinimum + (step * self.fStep) + if value <= self.fMinimum: + realValue = self.fMinimum + elif value >= self.fMaximum: + realValue = self.fMaximum + else: + curStep = int((value - self.fMinimum) / self.fStep + 0.5) + realValue = self.fMinimum + (self.fStep * curStep) + + if realValue < self.fMinimum: + realValue = self.fMinimum + elif realValue > self.fMaximum: + realValue = self.fMaximum self.setValue(realValue)