From 1105bfe31c0304ffacd85363d070322049d564f1 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 6 Oct 2015 13:14:17 +0300 Subject: [PATCH] Apply widget value change by enter/tab event. --- src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp | 4 +++- src/ModuleBase/ModuleBase_WidgetIntValue.cpp | 4 +++- src/PartSet/PartSet_WidgetPoint2d.cpp | 8 ++++++-- src/PartSet/PartSet_WidgetPoint2dDistance.cpp | 7 +++++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 47799fc54..8cf2d67cc 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -85,7 +85,9 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, mySpinBox->setToolTip(aTTip); aControlLay->addRow(myLabel, mySpinBox); - connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesChanged())); + // Apply widget value change by enter/tab event. + //connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesChanged())); + connect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged())); } ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index 6778b372c..622600ee2 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -84,7 +84,9 @@ ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(QWidget* theParent, mySpinBox->setToolTip(aTTip); aControlLay->addRow(myLabel, mySpinBox); - connect(mySpinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valuesChanged())); + // Apply widget value change by enter/tab event. + //connect(mySpinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valuesChanged())); + connect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged())); } ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index d94afa5a0..3e25988eb 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -88,7 +88,9 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, myXSpin->setToolTip(tr("X")); aGroupLay->addWidget(myXSpin, 0, 1); - connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged())); + // Apply widget value change by enter/tab event. + //connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged())); + connect(myXSpin, SIGNAL(editingFinished()), this, SLOT(onValuesChanged())); } { QLabel* aLabel = new QLabel(myGroupBox); @@ -101,7 +103,9 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, myYSpin->setToolTip(tr("Y")); aGroupLay->addWidget(myYSpin, 1, 1); - connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged())); + // Apply widget value change by enter/tab event. + //connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged())); + connect(myYSpin, SIGNAL(editingFinished()), this, SLOT(onValuesChanged())); } QVBoxLayout* aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp index ee59d8aee..297727d4e 100644 --- a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp +++ b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp @@ -34,8 +34,11 @@ PartSet_WidgetPoint2dDistance::PartSet_WidgetPoint2dDistance(QWidget* theParent, myFirstPntName = theData->getProperty("first_point"); // Reconnect to local slot - disconnect(mySpinBox, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged())); - connect(mySpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValuesChanged())); + // Apply widget value change by enter/tab event. + //disconnect(mySpinBox, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged())); + //connect(mySpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValuesChanged())); + disconnect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged())); + connect(mySpinBox, SIGNAL(editingFinished()), this, SLOT(onValuesChanged())); } PartSet_WidgetPoint2dDistance::~PartSet_WidgetPoint2dDistance() -- 2.39.2