From e8f0241d90471324a991bf6459eb8a5f4c3b704a Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 25 Apr 2016 16:14:55 +0300 Subject: [PATCH] Issue #1443: Do use current item name on checking unique name --- .../ParametersPlugin_WidgetParamsMgr.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; } -- 2.39.2