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

Method setGraphicsObject

QtNodeEditor/src/Connection.cpp:164–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162
163
164void
165Connection::
166setGraphicsObject(std::unique_ptr<ConnectionGraphicsObject>&& graphics)
167{
168 _connectionGraphicsObject = std::move(graphics);
169
170 // This function is only called when the ConnectionGraphicsObject
171 // is newly created. At this moment both end coordinates are (0, 0)
172 // in Connection G.O. coordinates. The position of the whole
173 // Connection G. O. in scene coordinate system is also (0, 0).
174 // By moving the whole object to the Node Port position
175 // we position both connection ends correctly.
176
177 if (requiredPort() != PortType::None)
178 {
179
180 PortType attachedPort = oppositePort(requiredPort());
181
182 PortIndex attachedPortIndex = getPortIndex(attachedPort);
183
184 auto node = getNode(attachedPort);
185
186 QTransform nodeSceneTransform =
187 node->nodeGraphicsObject().sceneTransform();
188
189 QPointF pos = node->nodeGeometry().portScenePosition(attachedPortIndex,
190 attachedPort,
191 nodeSceneTransform);
192
193 _connectionGraphicsObject->setPos(pos);
194 }
195
196 _connectionGraphicsObject->move();
197}
198
199
200

Callers

nothing calls this directly

Calls 1

oppositePortFunction · 0.85

Tested by

no test coverage detected