Commit 1be044d6 authored by Bob Obara's avatar Bob Obara Committed by Kitware Robot

Merge topic 'addAttributeRenameWarning'

10e7dcab BUG: GUI allows an attribute to be "renamed" with a name already is use
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: John Tourtellott's avatarJohn Tourtellott <john.tourtellott@kitware.com>
Merge-request: !1514
parents d0f42b62 10e7dcab
Pipeline #133824 running with stage
......@@ -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