| 162 | |
| 163 | |
| 164 | void |
| 165 | Connection:: |
| 166 | setGraphicsObject(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 |
nothing calls this directly
no test coverage detected