summaryrefslogtreecommitdiffhomepage
path: root/gui/options-dialog.cpp
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 /gui/options-dialog.cpp
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 'gui/options-dialog.cpp')
-rw-r--r--gui/options-dialog.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp
index ac4117bc..ab36d73b 100644
--- a/gui/options-dialog.cpp
+++ b/gui/options-dialog.cpp
@@ -167,13 +167,8 @@ options_dialog::options_dialog(std::unique_ptr<ITrackerDialog>& tracker_dialog_,
{
tmp val = val_;
val.label->setText(kopts_to_string(val.opt));
- connect(&val.opt.keycode,
- static_cast<void (value_::*)(const QString&) const>(&value_::valueChanged),
- val.label,
- [=](const QString&) { val.label->setText(kopts_to_string(val.opt)); });
- {
- connect(val.button, &QPushButton::clicked, this, [=] { bind_key(val.opt, val.label); });
- }
+ val.opt.keycode.connect_to(val.label, [=] { val.label->setText(kopts_to_string(val.opt)); }, Qt::DirectConnection);
+ connect(val.button, &QPushButton::clicked, this, [=] { bind_key(val.opt, val.label); });
}
auto add_module_tab = [this] (auto& place, auto&& dlg, const QString& label) {