{
bool isOk;
double aDefValue = QString::fromStdString(myDefaultValue).toDouble(&isOk);
-
- myXSpin->setValue(isOk ? aDefValue : 0.0);
- myYSpin->setValue(isOk ? aDefValue : 0.0);
+ // it is important to block the spin box control in order to do not through out the
+ // locking of the validating state.
+ setSpinValue(myXSpin, isOk ? aDefValue : 0.0);
+ setSpinValue(myYSpin, isOk ? aDefValue : 0.0);
}
PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D()
return false;
if (fabs(theY) >= MaxCoordinate)
return false;
- bool isBlocked = this->blockSignals(true);
- myXSpin->blockSignals(true);
- myXSpin->setValue(theX);
- myXSpin->blockSignals(false);
- myYSpin->blockSignals(true);
- myYSpin->setValue(theY);
- myYSpin->blockSignals(false);
- this->blockSignals(isBlocked);
+ setSpinValue(myXSpin, theX);
+ setSpinValue(myYSpin, theY);
storeValue();
return true;
double _X = aPoint->x();
double _Y = aPoint->y();
#endif
- bool isBlocked = this->blockSignals(true);
- myXSpin->blockSignals(true);
- myXSpin->setValue(aPoint->x());
- myXSpin->blockSignals(false);
-
- myYSpin->blockSignals(true);
- myYSpin->setValue(aPoint->y());
- myYSpin->blockSignals(false);
- this->blockSignals(isBlocked);
+
+ setSpinValue(myXSpin, aPoint->x());
+ setSpinValue(myYSpin, aPoint->y());
return true;
}
myWorkshop->operationMgr()->setLockValidating(false);
emit valuesChanged();
}
+
+void PartSet_WidgetPoint2D::setSpinValue(ModuleBase_DoubleSpinBox* theSpin, double theValue)
+{
+ bool isBlocked = theSpin->blockSignals(true);
+ theSpin->setValue(theValue);
+ theSpin->blockSignals(isBlocked);
+}
bool getPoint2d(const Handle(V3d_View)& theView, const TopoDS_Shape& theShape,
double& theX, double& theY) const;
+ /// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged)
+ /// \param theSpin an X or Y coordinate widget
+ /// \param theValue a new value
+ static void setSpinValue(ModuleBase_DoubleSpinBox* theSpin, double theValue);
+
XGUI_Workshop* myWorkshop;
QGroupBox* myGroupBox; ///< the parent group box for all intenal widgets