summaryrefslogtreecommitdiffhomepage
path: root/options/tie.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-24 23:14:07 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-24 23:14:07 +0100
commit9d84fa654f1a234f482d289bbd85740c427036bb (patch)
tree07925c86422c3443f9c0cb8710dfcdee9e89402d /options/tie.hpp
parentf3e4cbfdfb7aa9fed6f36597ce1f880240e6b40e (diff)
options/tie: clarify threading logic
Forcefully run in the widget's thread in both signal cases. If the connection is made and the widget's moved to another thread after, we'll observe the "epileptic slider" issue again. Clarify by explicitly using Qt::DirectConnection.
Diffstat (limited to 'options/tie.hpp')
-rw-r--r--options/tie.hpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/options/tie.hpp b/options/tie.hpp
index 49b8fd1b..544d4d87 100644
--- a/options/tie.hpp
+++ b/options/tie.hpp
@@ -148,17 +148,21 @@ inline void tie_setting(value<slider_value>& v, QSlider* w)
w->setValue(v().to_slider_pos(q_min, q_max));
});
},
- v.DIRECT_CONNTYPE);
+ Qt::DirectConnection);
base_value::connect(&v,
static_cast<void(base_value::*)(const slider_value&) const>(&base_value::valueChanged),
w,
[=, &v](double) {
- const int q_min = w->minimum();
- const int q_max = w->maximum();
- w->setValue(v().to_slider_pos(q_min, q_max));
- v = v().update_from_slider(w->value(), q_min, q_max);
+ run_in_thread_sync(w, [=, &v]()
+ {
+ const int q_min = w->minimum();
+ const int q_max = w->maximum();
+ const int pos = v().to_slider_pos(q_min, q_max);
+ w->setValue(pos);
+ v = v().update_from_slider(w->value(), q_min, q_max);
+ });
},
- v.SAFE_CONNTYPE);
+ Qt::DirectConnection);
}
}