Salome HOME
Improve multi-selector control to provide items multi-selection and "Delete" context...
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.cpp
index 66f2979fa4dd03f45a2383900d285b7c89fd4230..6cbbe1c80c3361ba65c7009a2b57c7ac62f63f77 100755 (executable)
@@ -5,6 +5,8 @@
 // Author:      Vitaly Smetannikov
 
 #include "ModuleBase_Tools.h"
+
+#include <ModuleBase_ParamIntSpinBox.h>
 #include <ModuleBase_ParamSpinBox.h>
 
 #include <ModelAPI_Attribute.h>
@@ -190,6 +192,26 @@ void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue)
   theSpin->blockSignals(isBlocked);
 }
 
+void setSpinText(ModuleBase_ParamIntSpinBox* theSpin, const QString& theText)
+{
+  // In order to avoid extra text setting because it will
+  // reset cursor position in control
+  if (theSpin->text() == theText)
+    return;
+  bool isBlocked = theSpin->blockSignals(true);
+  theSpin->setText(theText);
+  theSpin->blockSignals(isBlocked);
+}
+
+void setSpinValue(ModuleBase_ParamIntSpinBox* theSpin, int theValue)
+{
+  if (theSpin->value() == theValue)
+    return;
+  bool isBlocked = theSpin->blockSignals(true);
+  theSpin->setValue(theValue);
+  theSpin->blockSignals(isBlocked);
+}
+
 QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
 {
   QString aFeatureStr = "feature";