summaryrefslogtreecommitdiffhomepage
path: root/tracker-trackhat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-07-01 18:07:03 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-07-01 18:07:03 +0200
commita67e8630caf20e7f48151024e9e68dd9271d75c7 (patch)
treee7418eabdfb4abd6ca88c0ba6a427ca5a40e7c32 /tracker-trackhat
parent74dff816c07737b7e697e5d63222e59a9fefe23e (diff)
options/value: add `QObject::connect` wrapper
This is useful not just to save on complexity in call sites, but also because I plan on using the Verdigris library to remove needless `valueChanged()` and `setValue()` overloads from each `value<t>` instance. Also fix a bug in `options/tie.hpp` where `QComboBox::setCurrentIndex` was erroneously called as `Qt::DirectConnection`.
Diffstat (limited to 'tracker-trackhat')
-rw-r--r--tracker-trackhat/camera.cpp4
-rw-r--r--tracker-trackhat/dialog.cpp21
2 files changed, 12 insertions, 13 deletions
diff --git a/tracker-trackhat/camera.cpp b/tracker-trackhat/camera.cpp
index 74e35423..0c18dd03 100644
--- a/tracker-trackhat/camera.cpp
+++ b/tracker-trackhat/camera.cpp
@@ -57,9 +57,7 @@ trackhat_camera::trackhat_camera()
for (auto* slider : { &t.exposure, &t.gain, /*&t.threshold,*/ })
{
- QObject::connect(slider, options::value_::value_changed<options::slider_value>(),
- &sig, &trackhat_impl::setting_receiver::settings_changed,
- Qt::DirectConnection);
+ slider->connect_to(&sig, &trackhat_impl::setting_receiver::settings_changed, Qt::DirectConnection);
}
}
diff --git a/tracker-trackhat/dialog.cpp b/tracker-trackhat/dialog.cpp
index 4ef64f50..e18c89cf 100644
--- a/tracker-trackhat/dialog.cpp
+++ b/tracker-trackhat/dialog.cpp
@@ -37,8 +37,7 @@ trackhat_dialog::trackhat_dialog()
tie_setting(t.exposure, ui.exposure_slider);
ui.exposure_label->setValue((int)*t.exposure);
- connect(&t.exposure, value_::value_changed<slider_value>(), ui.exposure_label,
- [this] { ui.exposure_label->setValue((int)*t.exposure); }, Qt::QueuedConnection);
+ t.exposure.connect_to(ui.exposure_label, [this] { ui.exposure_label->setValue((int)*t.exposure); });
// gain
@@ -48,8 +47,7 @@ trackhat_dialog::trackhat_dialog()
tie_setting(t.gain, ui.gain_slider);
ui.gain_label->setValue((int)*t.gain);
- connect(&t.gain, value_::value_changed<slider_value>(), ui.gain_label,
- [this] { ui.gain_label->setValue((int)*t.gain); }, Qt::QueuedConnection);
+ t.gain.connect_to(ui.gain_label, [this] { ui.gain_label->setValue((int)*t.gain); });
#if 0
// threshold
@@ -66,21 +64,24 @@ trackhat_dialog::trackhat_dialog()
// point filter
ui.point_filter_limit_label->setValue(*t.point_filter_limit);
- connect(&t.point_filter_limit, value_::value_changed<slider_value>(), ui.point_filter_limit_label,
- [this] { ui.point_filter_limit_label->setValue(*t.point_filter_limit); }, Qt::QueuedConnection);
+ t.point_filter_limit.connect_to(ui.point_filter_limit_label, [this] {
+ ui.point_filter_limit_label->setValue(*t.point_filter_limit);
+ });
tie_setting(t.enable_point_filter, ui.enable_point_filter);
tie_setting(t.point_filter_coefficient, ui.point_filter_slider);
ui.point_filter_label->setValue(*t.point_filter_coefficient);
- connect(&t.point_filter_coefficient, value_::value_changed<slider_value>(), ui.point_filter_label,
- [this] { ui.point_filter_label->setValue(*t.point_filter_coefficient); }, Qt::QueuedConnection);
+ t.point_filter_coefficient.connect_to(ui.point_filter_label, [this] {
+ ui.point_filter_label->setValue(*t.point_filter_coefficient);
+ });
tie_setting(t.point_filter_deadzone, ui.point_filter_deadzone);
ui.point_filter_deadzone_label->setValue(*t.point_filter_deadzone);
- connect(&t.point_filter_deadzone, value_::value_changed<slider_value>(), ui.point_filter_deadzone_label,
- [this] { ui.point_filter_deadzone_label->setValue(*t.point_filter_deadzone); }, Qt::QueuedConnection);
+ t.point_filter_deadzone.connect_to(ui.point_filter_deadzone_label, [this] {
+ ui.point_filter_deadzone_label->setValue(*t.point_filter_deadzone);
+ });
// led