]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp
Salome HOME
Issue #1443: Do use current item name on checking unique name
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_WidgetParamsMgr.cpp
index 2f1e3a6a3638057ff35ea9f72587db55c877774d..6761331282f4a3975a22792370c05bf94f0d75ac 100644 (file)
@@ -331,7 +331,10 @@ void ParametersPlugin_WidgetParamsMgr::onCloseEditor(QWidget* theEditor,
       if (!aText.isEmpty()) {
         if (hasName(aText)) {
           myMessage = tr("Name %1 already exists.").arg(aText);
-          aItem->setText(Col_Name, aStringAttr->value().c_str());
+          if (aStringAttr->value().length() > 0)
+            aItem->setText(Col_Name, aStringAttr->value().c_str());
+          else 
+            aItem->setText(Col_Name, NoName);
           QTimer::singleShot(50, this, SLOT(sendWarning()));
           return;
         }
@@ -593,9 +596,12 @@ void ParametersPlugin_WidgetParamsMgr::onDown()
 
 bool ParametersPlugin_WidgetParamsMgr::hasName(const QString& theName) const
 {
+  int aCurrent = myDelegate->editIndex().row();
+  int i = 0;
   foreach(FeaturePtr aFeature, myParametersList) {
-    if (aFeature->data()->name() == theName.toStdString())
+    if ((i != aCurrent) && (aFeature->data()->name() == theName.toStdString()))
       return true;
+    i++;
   }
   return false;
 }