]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #720:Set cursor at the same position at editing of text in spin box
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 6 Jul 2015 15:05:36 +0000 (18:05 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 6 Jul 2015 15:05:36 +0000 (18:05 +0300)
src/ModuleBase/ModuleBase_Tools.cpp

index 2deb05c7c5206d77ddb3e441fe867f2770c77955..d62879f7f6ff47dccbfb9f75ac2073bed9ada638 100644 (file)
@@ -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)