Skip to content

Commit

Permalink
Fix for naming index bug enigma-dev#223
Browse files Browse the repository at this point in the history
  • Loading branch information
KartikShrivastava committed Apr 17, 2022
1 parent 31dbcb7 commit 6339912
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,13 @@ void MainWindow::CreateResource(TypeCase typeCase) {
refl->MutableMessage(&child, field);

// find a unique name for the new resource
child.set_name(resourceMap->CreateResourceName(&child).toStdString());
QString resourceName = resourceMap->CreateResourceName(&child);
child.set_name(resourceName.toStdString());

// add new resource with created name, helps in creating another unique name
auto messageModelRef = MessageModel(ProtoModel::NonProtoParent{this}, &child);
resourceMap->AddResource(typeCase, resourceName, &messageModelRef);

// release ownership of the new child to its parent and the tree
auto index = this->treeModel->addNode(child, _ui->treeView->currentIndex());
treeModel->triggerNodeEdit(index, _ui->treeView);
Expand Down

0 comments on commit 6339912

Please sign in to comment.