From: vsv Date: Mon, 6 Jul 2015 15:05:36 +0000 (+0300) Subject: Issue #720:Set cursor at the same position at editing of text in spin box X-Git-Tag: V_1.3.0~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1804fe9b51c902003511022872a64ef4bc7775fc;p=modules%2Fshaper.git Issue #720:Set cursor at the same position at editing of text in spin box --- diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 2deb05c7c..d62879f7f 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -113,9 +113,13 @@ QPixmap lighter(const QString& theIcon, const int theLighterValue) void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText) { - bool isBlocked = theSpin->blockSignals(true); - theSpin->setText(theText); - theSpin->blockSignals(isBlocked); + if (theSpin->text() != theText) { + // In order to avoid extra text setting because it will + // reset cursor position in control + bool isBlocked = theSpin->blockSignals(true); + theSpin->setText(theText); + theSpin->blockSignals(isBlocked); + } } void setSpinValue(QDoubleSpinBox* theSpin, double theValue)