def update(self): '''Update the coordinates of the line.''' # Get the two shapes of each node sourceShape = self.source.mapToScene(self.source.shape()) destShape = self.dest.mapToScene(self.dest.shape()) # Compute the closest points between the two shapes pSource = EdgeUtils.closestPointTo(destShape.boundingRect().center(), sourceShape) pDest = EdgeUtils.closestPointTo(sourceShape.boundingRect().center(), destShape) # Draw a line between source and dest self.setLine(pSource.x(), pSource.y(), pDest.x(), pDest.y())
def update(self, source): '''Update the coordinates of the line. Argument(s): source (QPointF): Source point ''' destShape = self.dest.mapToScene(self.dest.shape()) p = EdgeUtils.closestPointTo(source, destShape) self.setLine(source.x(), source.y(), p.x(), p.y())