diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2016-11-13 22:30:56 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2016-11-13 23:33:12 +0900 |
commit | 291a19f7d3cd6aa7e1b612da34c5747aea07e119 (patch) | |
tree | 2bb47e05b56a9478baf1847013a690cb1ee81fc1 /tdeui | |
parent | df11fa8daa57ec3b3983735bd339916fd492efe1 (diff) | |
download | tdelibs-291a19f7d3cd6aa7e1b612da34c5747aea07e119.tar.gz tdelibs-291a19f7d3cd6aa7e1b612da34c5747aea07e119.zip |
tdeui: fixed handling of setPrecision() for KDoubleSpinBox. This resolves bug 2717.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit f32bc5176289b70bf1c6e7d2825d53f190bc4096)
Diffstat (limited to 'tdeui')
-rw-r--r-- | tdeui/knuminput.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tdeui/knuminput.cpp b/tdeui/knuminput.cpp index f39d07443..7d1fa260f 100644 --- a/tdeui/knuminput.cpp +++ b/tdeui/knuminput.cpp @@ -1054,13 +1054,28 @@ void KDoubleSpinBox::setPrecision( int precision ) { } void KDoubleSpinBox::setPrecision( int precision, bool force ) { - if ( precision < 1 ) return; + if ( precision < 0 ) return; if ( !force ) { int maxPrec = maxPrecision(); if ( precision > maxPrec ) + { precision = maxPrec; + } } + // Update minValue, maxValue, value and lineStep to match the precision change + int oldPrecision = d->mPrecision; + double oldValue = value(); + double oldMinValue = minValue(); + double oldMaxValue = maxValue(); + double oldLineStep = lineStep(); d->mPrecision = precision; + if (precision != oldPrecision) + { + setMinValue(oldMinValue); + setMaxValue(oldMaxValue); + setValue(oldValue); + setLineStep(oldLineStep); + } updateValidator(); } |