summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2010-01-12 14:53:58 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2010-01-12 14:53:58 (GMT)
commitf71b48c70e215fec77be3b2688ac197cd7f13525 (patch)
tree7f239caa460f167420929e2898f11b0591feb236 /src
parenta902d9e486a0e2460f4888ce610bac269abc5563 (diff)
parent12e320a7a3a5ca93dd5287315571db1d1728e322 (diff)
downloadQt-f71b48c70e215fec77be3b2688ac197cd7f13525.zip
Qt-f71b48c70e215fec77be3b2688ac197cd7f13525.tar.gz
Qt-f71b48c70e215fec77be3b2688ac197cd7f13525.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qspinbox.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index 50b225c..f382f96 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -99,6 +99,10 @@ public:
Q_Q(QDoubleSpinBox);
q->setInputMethodHints(Qt::ImhFormattedNumbersOnly);
}
+
+ // When fiddling with the decimals property, we may lose precision in these properties.
+ double actualMin;
+ double actualMax;
};
@@ -762,6 +766,7 @@ double QDoubleSpinBox::minimum() const
void QDoubleSpinBox::setMinimum(double minimum)
{
Q_D(QDoubleSpinBox);
+ d->actualMin = minimum;
const QVariant m(d->round(minimum));
d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m));
}
@@ -792,6 +797,7 @@ double QDoubleSpinBox::maximum() const
void QDoubleSpinBox::setMaximum(double maximum)
{
Q_D(QDoubleSpinBox);
+ d->actualMax = maximum;
const QVariant m(d->round(maximum));
d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m);
}
@@ -813,6 +819,8 @@ void QDoubleSpinBox::setMaximum(double maximum)
void QDoubleSpinBox::setRange(double minimum, double maximum)
{
Q_D(QDoubleSpinBox);
+ d->actualMin = minimum;
+ d->actualMax = maximum;
d->setRange(QVariant(d->round(minimum)), QVariant(d->round(maximum)));
}
@@ -843,7 +851,7 @@ void QDoubleSpinBox::setDecimals(int decimals)
Q_D(QDoubleSpinBox);
d->decimals = qBound(0, decimals, DBL_MAX_10_EXP + DBL_DIG);
- setRange(minimum(), maximum()); // make sure values are rounded
+ setRange(d->actualMin, d->actualMax); // make sure values are rounded
setValue(value());
}
@@ -1051,8 +1059,10 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate()
{
- minimum = QVariant(0.0);
- maximum = QVariant(99.99);
+ actualMin = 0.0;
+ actualMax = 99.99;
+ minimum = QVariant(actualMin);
+ maximum = QVariant(actualMax);
value = minimum;
singleStep = QVariant(1.0);
decimals = 2;