From 0c2f603e8e37aac9f05d1710dec8bef7313d0326 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 7 Nov 2016 12:00:46 +0300 Subject: [PATCH] #1792 Wrong behaviour of angle input widget --- src/ModuleBase/ModuleBase_ParamSpinBox.cpp | 1 + src/ModuleBase/ModuleBase_ParamSpinBox.h | 3 +++ src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp | 3 ++- src/PartSet/PartSet_WidgetPoint2d.cpp | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index c8871269d..7dd3e3638 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -90,6 +90,7 @@ void ModuleBase_ParamSpinBox::connectSignalsAndSlots() void ModuleBase_ParamSpinBox::onTextChanged(const QString& text) { myTextValue = text; + emit textChanged(text); } double ModuleBase_ParamSpinBox::valueFromText(const QString& theText) const diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.h b/src/ModuleBase/ModuleBase_ParamSpinBox.h index 774c53586..bad249c7f 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.h +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.h @@ -76,6 +76,9 @@ protected: /// \param outValue an output value of the variable bool findVariable(const QString& theName, double& outValue) const; +signals: + void textChanged(const QString& theText); + protected: virtual void showEvent(QShowEvent*); diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 9dc18d598..9e4a2041e 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -91,7 +91,8 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, myLabel->setToolTip(aTTip); aControlLay->addRow(myLabel, mySpinBox); - connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified())); + // we should listen textChanged signal as valueChanged do not send when text is modified + connect(mySpinBox, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); mySpinBox->setValueEnabled(isValueEnabled()); } diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index e83e75751..c07953f44 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -100,7 +100,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, myXSpin->setToolTip(tr("X")); aGroupLay->addWidget(myXSpin, 0, 1); - connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified())); + connect(myXSpin, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); myXSpin->setValueEnabled(isValueEnabled()); } { @@ -115,7 +115,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, myYSpin->setToolTip(tr("Y")); aGroupLay->addWidget(myYSpin, 1, 1); - connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified())); + connect(myYSpin, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); myYSpin->setValueEnabled(isValueEnabled()); } QVBoxLayout* aLayout = new QVBoxLayout(this); -- 2.39.2