summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-01 22:44:23 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-01 22:44:23 +0100
commit1eb2ed6e95332bc6568d796226986e78a02d4785 (patch)
tree88078b80727f24c387e9ccbb2732a97f4d18f900 /options
parent6656b9f5b99733e88c776579dcaa07877d816a79 (diff)
options/tie: fix combobox with single element on reload
This was breaking the camera list with only one camera present.
Diffstat (limited to 'options')
-rw-r--r--options/tie.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/options/tie.cpp b/options/tie.cpp
index c2976217..adf26b53 100644
--- a/options/tie.cpp
+++ b/options/tie.cpp
@@ -28,8 +28,12 @@ void tie_setting(value<QString>& v, QComboBox* cb)
{
cb->setCurrentText(v);
v = cb->currentText();
- value_::connect(cb, SIGNAL(currentTextChanged(QString)), &v, SLOT(setValue(const QString&)), v.DIRECT_CONNTYPE);
- value_::connect(&v, SIGNAL(valueChanged(const QString&)), cb, SLOT(setCurrentText(const QString&)), v.SAFE_CONNTYPE);
+ auto set_current_text = [cb, &v](const QString& str) {
+ cb->setCurrentText(str);
+ v = cb->currentText();
+ };
+ value_::connect(cb, &QComboBox::currentTextChanged, &v, v.value_changed<QString>(), v.DIRECT_CONNTYPE);
+ value_::connect(&v, v.value_changed<QString>(), cb, set_current_text, v.SAFE_CONNTYPE);
}
void tie_setting(value<QVariant>& v, QComboBox* cb)