Skip to content
Snippets Groups Projects
Commit e11d140e authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

fix signal loop in updaters

parent fb611ff4
No related branches found
No related tags found
1 merge request!2764Small fixes in 2d canvas toolbar and activities
...@@ -37,7 +37,10 @@ QComboBox* GUI::Util::createComboBox(std::function<ComboProperty()> comboFunctio ...@@ -37,7 +37,10 @@ QComboBox* GUI::Util::createComboBox(std::function<ComboProperty()> comboFunctio
QObject::connect(combo, &QComboBox::currentTextChanged, [=] { slot(combo->currentText()); }); QObject::connect(combo, &QComboBox::currentTextChanged, [=] { slot(combo->currentText()); });
if (updaters) if (updaters)
(*updaters) << [=] { combo->setCurrentText(comboFunction().currentValue()); }; (*updaters) << [=] {
QSignalBlocker b(combo);
combo->setCurrentText(comboFunction().currentValue());
};
return combo; return combo;
} }
...@@ -37,7 +37,10 @@ QCheckBox* GUI::Util::createCheckBox(const QString& title, std::function<bool()> ...@@ -37,7 +37,10 @@ QCheckBox* GUI::Util::createCheckBox(const QString& title, std::function<bool()>
QObject::connect(result, &QCheckBox::stateChanged, [=] { setter(result->isChecked()); }); QObject::connect(result, &QCheckBox::stateChanged, [=] { setter(result->isChecked()); });
if (updaters) if (updaters)
(*updaters) << [=] { result->setChecked(getter()); }; (*updaters) << [=] {
QSignalBlocker b(result);
result->setChecked(getter());
};
return result; return result;
} }
...@@ -60,7 +63,10 @@ QSpinBox* GUI::Util::createIntSpinBox(std::function<int()> getter, std::function ...@@ -60,7 +63,10 @@ QSpinBox* GUI::Util::createIntSpinBox(std::function<int()> getter, std::function
QObject::connect(result, &QSpinBox::valueChanged, [=] { slot(result->value()); }); QObject::connect(result, &QSpinBox::valueChanged, [=] { slot(result->value()); });
if (updaters) if (updaters)
(*updaters) << [=] { result->setValue(getter()); }; (*updaters) << [=] {
QSignalBlocker b(result);
result->setValue(getter());
};
return result; return result;
} }
...@@ -85,7 +91,10 @@ QDoubleSpinBox* GUI::Util::createDoubleSpinBox(std::function<double()> getter, ...@@ -85,7 +91,10 @@ QDoubleSpinBox* GUI::Util::createDoubleSpinBox(std::function<double()> getter,
QObject::connect(result, &QDoubleSpinBox::valueChanged, [=] { slot(result->value()); }); QObject::connect(result, &QDoubleSpinBox::valueChanged, [=] { slot(result->value()); });
if (updaters) if (updaters)
(*updaters) << [=] { result->setValue(getter()); }; (*updaters) << [=] {
QSignalBlocker b(result);
result->setValue(getter());
};
return result; return result;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment