From a5f87d2fac8960154b9a9bc245d6fdfb14d0e801 Mon Sep 17 00:00:00 2001 From: Vadim Kuznetsov Date: Fri, 16 Feb 2024 10:58:13 +0300 Subject: [PATCH] Prevent starting simulation in multiple threads at tuning --- qucs/dialogs/tuner.cpp | 9 ++++++--- qucs/dialogs/tuner.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/qucs/dialogs/tuner.cpp b/qucs/dialogs/tuner.cpp index 3a03a30e5..4ba0000c4 100644 --- a/qucs/dialogs/tuner.cpp +++ b/qucs/dialogs/tuner.cpp @@ -265,7 +265,7 @@ void tunerElement::resetValue() value->setText(val); ValueUnitsCombobox->setCurrentIndex(index); updateSlider(); - slotValueChanged(); + slotValueChanged(false); } /* @@ -462,7 +462,7 @@ void tunerElement::slotSliderChanged() * The control reaches this function when one of the events above is triggered. It checks if the input value is correct, updates it * and finally runs the simulation */ -void tunerElement::slotValueChanged() +void tunerElement::slotValueChanged(bool simulate) { bool ok; float v = getValue(ok); @@ -501,7 +501,9 @@ void tunerElement::slotValueChanged() updateSlider(); updateProperty(); - emit elementValueUpdated(); + if (simulate) { + emit elementValueUpdated(); + } value->blockSignals(false); ValueUnitsCombobox->blockSignals(false); } @@ -803,6 +805,7 @@ void TunerDialog::slotResetValues() { currentElements.at(i)->resetValue(); } + slotElementValueUpdated(); } void TunerDialog::slotUpdateValues() diff --git a/qucs/dialogs/tuner.h b/qucs/dialogs/tuner.h index ab9940335..b122c3768 100644 --- a/qucs/dialogs/tuner.h +++ b/qucs/dialogs/tuner.h @@ -97,7 +97,7 @@ class tunerElement : public QWidget void slotMinValueChanged(); void slotMaxValueChanged(); void slotStepChanged(); - void slotValueChanged(); + void slotValueChanged(bool simulate = true); void slotDelete(); void slotDownClicked(); void slotUpClicked();