Skip to content

Commit 651ebcd

Browse files
russelltgpaceholder
authored andcommitted
Add signals to flowscene
1 parent 97a5629 commit 651ebcd

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/FlowScene.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ createConnection(PortType connectedPort,
5757

5858
_connections[connection->id()] = connection;
5959

60+
connectionCreated(*connection);
6061
return connection;
6162
}
6263

@@ -100,6 +101,7 @@ restoreConnection(Properties const &p)
100101

101102
_connections[connection->id()] = connection;
102103

104+
connectionCreated(*connection);
103105
return connection;
104106
}
105107

@@ -108,6 +110,7 @@ void
108110
FlowScene::
109111
deleteConnection(std::shared_ptr<Connection> connection)
110112
{
113+
connectionDeleted(*connection);
111114
connection->removeFromNodes();
112115
_connections.erase(connection->id());
113116
}
@@ -124,6 +127,7 @@ createNode(std::unique_ptr<NodeDataModel> && dataModel)
124127

125128
_nodes[node->id()] = node;
126129

130+
nodeCreated(*node);
127131
return node;
128132
}
129133

@@ -149,6 +153,8 @@ restoreNode(Properties const &p)
149153
node->restore(p);
150154

151155
_nodes[node->id()] = node;
156+
157+
nodeCreated(*node);
152158
return node;
153159
}
154160

@@ -158,7 +164,8 @@ FlowScene::
158164
removeNode(NodeGraphicsObject* ngo)
159165
{
160166
std::shared_ptr<Node> const node = ngo->node().lock();
161-
167+
nodeDeleted(*node);
168+
162169
auto deleteConnections = [&node, this] (PortType portType)
163170
{
164171
auto nodeState = node->nodeState();
@@ -183,7 +190,8 @@ FlowScene::
183190
removeConnection(ConnectionGraphicsObject* cgo)
184191
{
185192
std::shared_ptr<Connection> const conn = cgo->connection().lock();
186-
193+
connectionDeleted(*conn);
194+
187195
deleteConnection(conn);
188196
}
189197

src/FlowScene.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class NodeStyle;
2222
class NODE_EDITOR_PUBLIC FlowScene
2323
: public QGraphicsScene
2424
{
25+
Q_OBJECT
2526
public:
2627

2728
FlowScene(std::shared_ptr<DataModelRegistry> registry =
@@ -68,6 +69,13 @@ class NODE_EDITOR_PUBLIC FlowScene
6869
void
6970
load();
7071

72+
signals:
73+
void nodeCreated(Node& n);
74+
void nodeDeleted(Node& n);
75+
76+
void connectionCreated(Connection& c);
77+
void connectionDeleted(Connection& c);
78+
7179
private:
7280

7381
using SharedConnection = std::shared_ptr<Connection>;

0 commit comments

Comments
 (0)