summaryrefslogtreecommitdiffstats
path: root/tdeui
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2017-07-10 18:54:45 +0200
committerSlávek Banko <slavek.banko@axis.cz>2017-07-10 18:54:57 +0200
commitd923f1ece462123168215de5f3a778ea50288e19 (patch)
treef37bf1d45166abf8de4d404a1a7ba8e94d5e6c44 /tdeui
parent234f323f7b3ae009f4236a775a72dd96094ebba1 (diff)
downloadtdelibs-d923f1ece462123168215de5f3a778ea50288e19.tar.gz
tdelibs-d923f1ece462123168215de5f3a778ea50288e19.zip
tdeui: Update slider parameters together with changing precision of KDoubleNumInput
This relates to bug 2717 and resolves bug 2758 Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 2a8932682fd4cfcbd881b768859ce1d324179694)
Diffstat (limited to 'tdeui')
-rw-r--r--tdeui/knuminput.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tdeui/knuminput.cpp b/tdeui/knuminput.cpp
index 7d1fa260f..0ec38c973 100644
--- a/tdeui/knuminput.cpp
+++ b/tdeui/knuminput.cpp
@@ -769,7 +769,6 @@ void KDoubleNumInput::setRange(double lower, double upper, double step,
int slstep = spin->lineStep();
if (m_slider) {
m_slider->setRange(slmin, slmax);
- m_slider->setLineStep(slstep);
m_slider->setValue(slvalue);
} else {
m_slider = new TQSlider(slmin, slmax, slstep, slvalue,
@@ -784,6 +783,7 @@ void KDoubleNumInput::setRange(double lower, double upper, double step,
// calculate ( slmax - slmin ) / 10 without overflowing ints:
int major = calcDiffByTen( slmax, slmin );
if ( !major ) major = slstep; // ### needed?
+ m_slider->setSteps(slstep, major);
m_slider->setTickInterval(major);
} else {
delete m_slider;
@@ -859,6 +859,16 @@ void KDoubleNumInput::setPrefix(const TQString &prefix)
void KDoubleNumInput::setPrecision(int precision)
{
d->spin->setPrecision( precision );
+ if(m_slider) {
+ // upcast to base type to get the min/maxValue in int form:
+ TQSpinBox * spin = d->spin;
+ m_slider->setRange(spin->minValue(), spin->maxValue());
+ m_slider->setValue(spin->value());
+ int major = calcDiffByTen(spin->maxValue(), spin->minValue());
+ if ( !major ) major = spin->lineStep();
+ m_slider->setSteps(spin->lineStep(), major);
+ m_slider->setTickInterval(major);
+ }
layout(true);
}