MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / onAddToModelRegistry

Method onAddToModelRegistry

bt_editor/mainwindow.cpp:761–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759
760
761void MainWindow::onAddToModelRegistry(const NodeModel &model)
762{
763 namespace util = QtNodes::detail;
764 const auto& ID = model.registration_ID;
765
766 DataModelRegistry::RegistryItemCreator node_creator = [model]() -> DataModelRegistry::RegistryItemPtr
767 {
768 if( model.type == NodeType::SUBTREE)
769 {
770 return util::make_unique<SubtreeNodeModel>(model);
771 }
772 return util::make_unique<BehaviorTreeDataModel>(model);
773 };
774
775 _model_registry->registerModel( QString::fromStdString( toStr(model.type)), node_creator, ID);
776
777 if( model.type == NodeType::SUBTREE && getTabByName(model.registration_ID) == nullptr)
778 {
779 createTab(model.registration_ID);
780 }
781
782 _treenode_models.insert( {ID, model } );
783 _editor_widget->updateTreeView();
784}
785
786void MainWindow::onDestroySubTree(const QString &ID)
787{

Callers

nothing calls this directly

Calls 2

toStrFunction · 0.85
updateTreeViewMethod · 0.80

Tested by

no test coverage detected