]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2754: Objects of the same type can not have the same name.
authorvsv <vsv@opencascade.com>
Thu, 10 Jan 2019 12:27:32 +0000 (15:27 +0300)
committervsv <vsv@opencascade.com>
Thu, 10 Jan 2019 12:27:32 +0000 (15:27 +0300)
src/XGUI/XGUI_Tools.cpp

index aafafbfce01a3fc3916387ac4122e507cedc0c1e..e058ff8cf112f202a6e9ed898fb2fc67dff0d9e6 100644 (file)
@@ -166,16 +166,14 @@ bool canRename(const ObjectPtr& theObject, const QString& theName)
       return false;
     }
   }
-  else if ((aType == ModelAPI_ResultConstruction::group()) ||
-           (aType == ModelAPI_ResultBody::group())) {
+  else {
     DocumentPtr aDoc = theObject->document();
     ObjectPtr aObj =
-      aDoc->objectByName(ModelAPI_ResultConstruction::group(), theName.toStdString());
-    if (!aObj.get())
-      aObj = aDoc->objectByName(ModelAPI_ResultBody::group(), theName.toStdString());
+      aDoc->objectByName(aType, theName.toStdString());
 
     if (aObj.get()) {
-      QString aErrMsg(QObject::tr("Object with name %1 already exists.").arg(theName));
+      QString aErrMsg(QObject::tr("%1 with name %2 already exists.").
+        arg(aType.c_str()).arg(theName));
       // We can not use here a dialog box for message -
       // it will crash editing process in ObjectBrowser
       Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();