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

Method GraphicContainer

bt_editor/graphic_container.cpp:17–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using namespace QtNodes;
16
17GraphicContainer::GraphicContainer(std::shared_ptr<DataModelRegistry> model_registry,
18 QWidget *parent) :
19 QObject(parent),
20 _model_registry( std::move(model_registry) ),
21 _signal_was_blocked(true)
22{
23 _scene = new EditorFlowScene( _model_registry, parent );
24 _view = new QtNodes::FlowView( _scene, parent );
25
26 connect( _scene, &QtNodes::FlowScene::nodeDoubleClicked,
27 this, &GraphicContainer::onNodeDoubleClicked);
28
29 connect( _scene, &QtNodes::FlowScene::nodeCreated,
30 this, &GraphicContainer::onNodeCreated );
31
32 connect( _scene, &QtNodes::FlowScene::nodeContextMenu,
33 this, &GraphicContainer::onNodeContextMenu );
34
35 connect( _scene, &QtNodes::FlowScene::connectionContextMenu,
36 this, &GraphicContainer::onConnectionContextMenu );
37
38 connect( _scene, &QtNodes::FlowScene::nodeDeleted,
39 this, &GraphicContainer::undoableChange );
40
41 connect( _scene, &QtNodes::FlowScene::nodeMoved,
42 this, &GraphicContainer::undoableChange );
43
44 connect( _scene, &QtNodes::FlowScene::connectionDeleted,
45 this, &GraphicContainer::undoableChange );
46
47 connect( _view, &QtNodes::FlowView::startNodeDelete,
48 this, [this]()
49 {
50 _signal_was_blocked = this->blockSignals(true);
51 } );
52
53 connect( _view, &QtNodes::FlowView::finishNodeDelete,
54 this, [this]()
55 {
56 this->blockSignals(_signal_was_blocked);
57 this->undoableChange();
58 } );
59
60
61 connect( _scene, &QtNodes::FlowScene::connectionCreated,
62 this, [this](QtNodes::Connection &c )
63 {
64 if( c.getNode(QtNodes::PortType::In) && c.getNode(QtNodes::PortType::Out))
65 {
66 undoableChange();
67 }
68 });
69
70}
71
72void GraphicContainer::lockEditing(bool locked)
73{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected