From: vsv Date: Thu, 5 Jul 2018 13:36:27 +0000 (+0300) Subject: Issue #2533: Send signal on modified int value X-Git-Tag: EDF_2018-1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc1cec2db83b3b9cbf2d289fc0529feedceb1d67;p=modules%2Fshaper.git Issue #2533: Send signal on modified int value --- diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index 97b8e3f22..f3dfd36b5 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -110,7 +110,7 @@ void ModuleBase_ParamSpinBox::stepBy(int steps) double aVal = lineEdit()->text().toDouble(); aVal += steps * mySingleStep; setValue(aVal); - QAbstractSpinBox::stepBy(steps); + //QAbstractSpinBox::stepBy(steps); } void ModuleBase_ParamSpinBox::onTextChanged(const QString& theText) @@ -154,7 +154,9 @@ void ModuleBase_ParamSpinBox::setValue(double value) else if (aVal > myMaximum) aVal = myMaximum; QString aText = QString::number(aVal, 'g', decimals()); + lineEdit()->blockSignals(true); lineEdit()->setText(aText); + lineEdit()->blockSignals(false); emit textChanged(aText); } diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.h b/src/ModuleBase/ModuleBase_ParamSpinBox.h index 7e33da9c6..a2a408698 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.h +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.h @@ -104,6 +104,9 @@ protected: virtual bool eventFilter(QObject* theObj, QEvent* theEvent); + /// The virtual function is reimplemented in order to avoid extra increasing of value by StepBy + /// method + virtual void timerEvent(QTimerEvent *event) {} virtual StepEnabled stepEnabled() const { return StepUpEnabled | StepDownEnabled; } diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index e694d35f5..176fea5fc 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -101,7 +101,7 @@ ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(QWidget* theParent, myLabel->setToolTip(aTTip); aControlLay->addRow(myLabel, mySpinBox); - connect(mySpinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valuesModified())); + connect(mySpinBox, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); } ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue()