Commit 10e7dcab authored by Bob Obara's avatar Bob Obara

BUG: GUI allows an attribute to be "renamed" with a name already is use

- the attribute system does prevent the rename but the user is not notified the renaming did not occur.  Also the GUI does show the attribute with the new name until the view is refreshed
- this commit now presents a warning message and reverts the name displayed to the original value.
parent d0f42b62
......@@ -6,6 +6,7 @@ This view has the same syntax as an Attribute View but only allows the user to c
* If there is only one type of attribute being created/modified then the type column is no longer displayed
* For the time being the view by property feature has been disabled until we can decide on whether it is useful and if so, what is the best way to display the information.
* The column "Attribute" has been renamed to "Name"
* Attempting to rename an attribute to a name already is use now generates a warning dialog.
#New View Type - Analysis
An Analysis View is a specialized view for choosing the types of analyses the user wants to perform. These choices are persistent and can be used by an export operation instead of having the operator ask the user what types of analyses should be performed.
......
......@@ -477,6 +477,19 @@ void qtAttributeView::onAttributeNameChanged(QTableWidgetItem* item)
if (aAttribute && item->text().toStdString() != aAttribute->name())
{
ResourcePtr attResource = aAttribute->definition()->resource();
// Lets see if the name is in use
auto att = attResource->findAttribute(item->text().toStdString());
if (att != nullptr)
{
std::string s;
s = "Can't rename " + aAttribute->type() + ":" + aAttribute->name() +
". There already exists an attribute of type: " + att->type() + " named " + att->name() +
".";
QMessageBox::warning(this->Widget, "Attribute Can't be Renamed", s.c_str());
item->setText(aAttribute->name().c_str());
return;
}
attResource->rename(aAttribute, item->text().toStdString());
this->attributeChanged(aAttribute);
//aAttribute->definition()->setLabel(item->text().toAscii().constData());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment