FeaturePtr aFeature = myParametersList.at(myDelegate->editIndex().row());
QTreeWidgetItem* aItem = myParameters->child(myDelegate->editIndex().row());
int aColumn = myDelegate->editIndex().column();
+ int aRow = myDelegate->editIndex().row();
QString aText = aItem->text(aColumn);
bool isModified = false;
while (aText.indexOf(" ") != -1) {
aText.replace(" ", "");
}
- if (hasName(aText)) {
+ if (hasName(aText, aRow)) {
myMessage = translate("Name '%1' already exists.").arg(aText);
QTimer::singleShot(50, this, SLOT(sendWarning()));
return;
}
-bool ParametersPlugin_WidgetParamsMgr::hasName(const QString& theName) const
+bool ParametersPlugin_WidgetParamsMgr::hasName(const QString& theName, int theIndex) const
{
- int aCurrent = myDelegate->editIndex().row();
int i = 0;
foreach(FeaturePtr aFeature, myParametersList) {
- if ((i != aCurrent) && (aFeature->data()->name() == theName.toStdWString()))
+ if ((i != theIndex) && (aFeature->data()->name() == theName.toStdWString()))
return true;
i++;
}
//myRemoveBtn->setEnabled(isParameter);
myUpBtn->setEnabled(isParameter);
myDownBtn->setEnabled(isParameter);
+ myImportBtn->setEnabled(true);
} else {
myInsertBtn->setEnabled(false);
//myRemoveBtn->setEnabled(false);
myUpBtn->setEnabled(false);
myDownBtn->setEnabled(false);
+ myImportBtn->setEnabled(false);
}
myRemoveBtn->setEnabled(!aItemsList.isEmpty());
}
//myRemoveBtn->setEnabled(theEnable);
myUpBtn->setEnabled(theEnable);
myDownBtn->setEnabled(theEnable);
+ myImportBtn->setEnabled(theEnable);
}
myOkCancelBtn->button(QDialogButtonBox::Ok)->setEnabled(theEnable);
}
aItem = myParameters->child(i);
if ((aItem->text(Col_Name) == NoName) ||
(aItem->text(Col_Equation) == translate(NoValue)) ||
- (!ModelAPI_Expression::isVariable(aItem->text(Col_Name).toStdString())) ) {
+ (!ModelAPI_Expression::isVariable(aItem->text(Col_Name).toStdString())) ||
+ (hasName(aItem->text(Col_Name), i)) ) {
return false;
}
}