Commit 35799986 authored by SZPYRKA Jean-Luc's avatar SZPYRKA Jean-Luc

signal/slot fix for widgetsParameter

parent a9629c6e
......@@ -37,6 +37,12 @@ int main(int argc, char **argv)
dtkWidgetsParameter *first_real_parameter_widget = dtk::widgets::parameters::pluginFactory().create(&real_parameter, "dtkWidgetsParameterDoubleSpinBox");
dtkWidgetsParameter *second_real_parameter_widget = dtk::widgets::parameters::pluginFactory().create(&real_parameter, "dtkWidgetsParameterDoubleSpinBox");
real_parameter.connect([=] (QVariant v) {
double value = v.value<dtk::d_real>().value();
qInfo() << "real_parameter =" << value;
});
QList<QString> available_strings;
available_strings.append("FirstString");
available_strings.append("SecondString");
......@@ -48,10 +54,21 @@ int main(int argc, char **argv)
inliststring_parameter.setValue(QString("SecondString"));
dtkWidgetsParameter *inliststring_parameter_widget = dtk::widgets::parameters::pluginFactory().create(&inliststring_parameter, "dtkWidgetsParameterStringListComboBox");
inliststring_parameter.connect([=] (QVariant v) {
QString value = v.value<dtk::d_inliststring>().value();
qInfo() << "inliststring_parameter =" << value;
});
dtk::d_bool bool_parameter = true;
dtkWidgetsParameter *bool_parameter_widget = dtk::widgets::parameters::pluginFactory().create(&bool_parameter, "dtkWidgetsParameterBoolCheckBox");
bool_parameter.connect([=] (QVariant v) {
bool value = v.value<dtk::d_bool>().value();
qInfo() << "bool_parameter =" << value;
});
QVBoxLayout *central_layout = new QVBoxLayout;
central_layout->addWidget(first_real_parameter_widget);
central_layout->addWidget(second_real_parameter_widget);
......
......@@ -82,9 +82,7 @@ bool dtkWidgetsParameterBoolCheckBox::connect(dtkCoreParameter *p)
QObject::connect(d->check_box, &QCheckBox::stateChanged, [=] (int state)
{
m_parameter->block(true);
m_parameter->setValue(state == Qt::Checked);
m_parameter->block(false);
});
return true;
......
......@@ -75,9 +75,7 @@ bool dtkWidgetsParameterDoubleSpinBox::connect(dtkCoreParameter *p)
QObject::connect(d->spin_box, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double v)
{
m_parameter->block(true);
m_parameter->setValue(v);
m_parameter->block(false);
});
return true;
......
......@@ -76,9 +76,7 @@ bool dtkWidgetsParameterIntSlider::connect(dtkCoreParameter *p)
QObject::connect(d->slider, QOverload<int>::of(&QSlider::valueChanged), [=] (int v)
{
m_parameter->block(true);
m_parameter->setValue(v);
m_parameter->block(false);
});
return true;
......
......@@ -75,9 +75,7 @@ bool dtkWidgetsParameterIntSpinBox::connect(dtkCoreParameter *p)
QObject::connect(d->spin_box, QOverload<int>::of(&QSpinBox::valueChanged), [=] (int v)
{
m_parameter->block(true);
m_parameter->setValue(v);
m_parameter->block(false);
});
return true;
......
......@@ -79,9 +79,7 @@ bool dtkWidgetsParameterStringListComboBox::connect(dtkCoreParameter *p)
QObject::connect(d->combo_box, &QComboBox::currentTextChanged, [=] (const QString& v)
{
m_parameter->block(true);
m_parameter->setValue(v);
m_parameter->block(false);
});
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment