From: vsv Date: Mon, 25 Apr 2016 13:14:55 +0000 (+0300) Subject: Issue #1443: Do use current item name on checking unique name X-Git-Tag: V_2.3.0~109 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e8f0241d90471324a991bf6459eb8a5f4c3b704a;p=modules%2Fshaper.git Issue #1443: Do use current item name on checking unique name --- diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index 2f1e3a6a3..676133128 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -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; }