| 15 | using namespace QtNodes; |
| 16 | |
| 17 | GraphicContainer::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 | |
| 72 | void GraphicContainer::lockEditing(bool locked) |
| 73 | { |
nothing calls this directly
no outgoing calls
no test coverage detected