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

Method onConnectionContextMenu

bt_editor/graphic_container.cpp:567–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567void GraphicContainer::onConnectionContextMenu(QtNodes::Connection &connection, const QPointF&)
568{
569 QMenu* conn_menu = new QMenu(_view);
570
571 auto categories = {"Control", "Decorator"};
572
573 for(auto category: categories)
574 {
575 QMenu* submenu = conn_menu->addMenu(QString("Insert ") + category + QString("Node") );
576 auto model_names = _model_registry->registeredModelsByCategory( category );
577
578 if( model_names.empty() )
579 {
580 submenu->setEnabled(false);
581 }
582 else{
583 for(auto& name: model_names)
584 {
585 auto action = new QAction(name, submenu);
586 submenu->addAction(action);
587 connect( action, &QAction::triggered,
588 this, [this, &connection, name]
589 {
590 this->insertNodeInConnection( connection, name);
591 });
592 }
593 }
594 }
595
596 conn_menu->exec( QCursor::pos() );
597}
598
599void GraphicContainer::recursiveLoadStep(QPointF& cursor,
600 AbsBehaviorTree& tree,

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected