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

Method onNodeCreated

bt_editor/graphic_container.cpp:321–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321void GraphicContainer::onNodeCreated(Node &node)
322{
323 if( auto bt_node = dynamic_cast<BehaviorTreeDataModel*>( node.nodeDataModel() ) )
324 {
325 connect( bt_node, &BehaviorTreeDataModel::parameterUpdated,
326 this, &GraphicContainer::undoableChange );
327
328 connect( bt_node, &BehaviorTreeDataModel::portValueDoubleChicked,
329 this, &GraphicContainer::onPortValueDoubleClicked );
330
331 connect( bt_node, &BehaviorTreeDataModel::instanceNameChanged,
332 this, &GraphicContainer::undoableChange );
333
334 if( auto subtree_node = dynamic_cast<SubtreeNodeModel*>( bt_node ) )
335 {
336 auto main_win = dynamic_cast<MainWindow*>( parent() );
337 if( main_win && main_win->getTabByName( bt_node->registrationName() ) == nullptr )
338 {
339 subtree_node->expandButton()->setEnabled(true);
340 }
341 connect( subtree_node, &SubtreeNodeModel::expandButtonPushed,
342 &(node), [&node, this]()
343 {
344 emit requestSubTreeExpand( *this, node );
345 });
346 }
347
348 bt_node->initWidget();
349 }
350 undoableChange();
351}
352
353void GraphicContainer::onNodeContextMenu(Node &node, const QPointF &)
354{

Callers

nothing calls this directly

Calls 3

getTabByNameMethod · 0.80
expandButtonMethod · 0.80
initWidgetMethod · 0.80

Tested by

no test coverage detected