summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-17 14:29:02 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-17 15:01:48 +0200
commitc05cdde5231139fc7224e3f92dfbaa407a603d9a (patch)
tree47c4ec9cf43d20d61d14f251a6c0553bd888e74b /options
parent7bf4dec2e22d07ba24d40d5c9f9ad5f5bf9f937e (diff)
options/tie: don't reinvent slider stuff
Diffstat (limited to 'options')
-rw-r--r--options/tie.hpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/options/tie.hpp b/options/tie.hpp
index 22b46bd0..c1eb1b92 100644
--- a/options/tie.hpp
+++ b/options/tie.hpp
@@ -140,14 +140,8 @@ inline void tie_setting(value<slider_value>& v, QSlider* w)
const int q_min = w->minimum();
const int q_max = w->maximum();
- {
- const int q_diff = q_max - q_min;
- slider_value sv(v);
- const double sv_c = sv.max() - sv.min();
-
- w->setValue(int((sv.cur() - sv.min()) / sv_c * q_diff + q_min));
- v = slider_value(q_diff <= 0 ? 0 : (w->value() - q_min) * sv_c / (double)q_diff + sv.min(), sv.min(), sv.max());
- }
+ w->setValue(v->to_slider_pos(q_min, q_max));
+ v = v->update_from_slider(w->value(), q_min, q_max);
base_value::connect(w,
&QSlider::valueChanged,