diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-05 15:54:01 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-05 14:35:29 +0000 |
commit | f0216a3c53d43918295f1bd81975b391f4e5ed3b (patch) | |
tree | b6311d48559bbdb4b657beed1bd8164d9157b03f /options/tie.hpp | |
parent | 39ea3871c1b3f594df846bc0b9a627c9880ecea4 (diff) |
options: don't use typeindex w/ lambdas
Rename traits' functions to be more explicit.
Most of the changes are pretty old and I can't read
them at this time, sorry.
Adjust usages.
Issue: #825
Reported-by: @DanielKinsman
Diffstat (limited to 'options/tie.hpp')
-rw-r--r-- | options/tie.hpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/options/tie.hpp b/options/tie.hpp index f2ec751d..c2607a6c 100644 --- a/options/tie.hpp +++ b/options/tie.hpp @@ -36,20 +36,17 @@ std::enable_if_t<std::is_enum_v<t>> tie_setting(value<t>& v, QComboBox* cb) cb->setCurrentIndex(cb->findData(int(static_cast<t>(v)))); v = static_cast<t>(cb->currentData().toInt()); - value_::connect(cb, - static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), - &v, [&v, cb](int idx) { - run_in_thread_sync(cb, [&] { - v = static_cast<t>(cb->itemData(idx).toInt()); - }); - }, - v.DIRECT_CONNTYPE); + value_::connect(cb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + &v, [&v, cb](int idx) { + run_in_thread_sync(cb, [&] { + v = static_cast<t>(cb->itemData(idx).toInt()); + }); + }, v.DIRECT_CONNTYPE); value_::connect(&v, value_::value_changed<int>(), - cb, [cb](int x) { + cb, [cb](int x) { run_in_thread_sync(cb, [=] { cb->setCurrentIndex(cb->findData(x)); }); - }, - v.DIRECT_CONNTYPE); + }, v.DIRECT_CONNTYPE); } template<typename t, typename From, typename To> @@ -79,8 +76,8 @@ void tie_setting(value<t>& v, QLabel* lb, F&& fun) closure(v()); value_::connect(&v, value_::value_changed<t>(), - lb, closure, - v.SAFE_CONNTYPE); + lb, closure, + v.SAFE_CONNTYPE); } template<typename t, typename F> @@ -92,8 +89,8 @@ void tie_setting(value<t>& v, QObject* obj, F&& fun) fun(v()); value_::connect(&v, value_::value_changed<t>(), - obj, fun, - v.DIRECT_CONNTYPE); + obj, fun, + v.DIRECT_CONNTYPE); } OTR_OPTIONS_EXPORT void tie_setting(value<int>& v, QComboBox* cb); |