nodeeditor icon indicating copy to clipboard operation
nodeeditor copied to clipboard

FlowScene::connectionCreated emits while Input Port is nullptr.

Open chriamue opened this issue 6 years ago • 2 comments

When I listen to this [signal] (https://github.com/paceholder/nodeeditor/blob/87f0d386bfca24958e4ee2bd52763a13eb04ce10/include/ nodes/internal/FlowScene.hpp#L106) void connectionCreated(Connection &c); , it gets emitted when clicking visually on an output port.

` void NodeGraphicsObject:: mousePressEvent(QGraphicsSceneMouseEvent * event) { ...

auto connection = _scene.createConnection(portToCheck, _node, portIndex); ...

} `

At this point the input port is still not selected. The signal should be emit, after connections output port and input port is selected and connection was created.

chriamue avatar Jun 07 '18 09:06 chriamue

Adding this to ConnectionGraphicsObject:: mouseReleaseEvent(QGraphicsSceneMouseEvent* event) works for me: `if (node && interaction.tryConnect()) { node->resetReactionToConnection(); _scene.connectionCreated(_connection);

}` But I'm not sure about side effects.

chriamue avatar Jun 07 '18 10:06 chriamue

Yes, it does this. The connection object is technically created, so it emits the signal even though it isn't between two nodes. #175 actually fixes this (or it would be a bug in my implementation)

Quincunx271 avatar Jun 07 '18 15:06 Quincunx271