def draw_connection_line(painter, x1, y1, x2, y2, h1, h2): # Account for list view headers. y1 += h1 y2 += h2 # Invisible output ports don't get a connecting dot. if y1 > h1: painter.drawLine(x1, y1, x1 + 4, y1) # Setup control points spline = QPolygon(4) cp = int((x2 - x1 - 8) * 0.4) spline.setPoints(x1 + 4, y1, x1 + 4 + cp, y1, x2 - 4 - cp, y2, x2 - 4, y2) # The connection line path = QPainterPath() path.moveTo(spline.at(0)) path.cubicTo(spline.at(1), spline.at(2), spline.at(3)) painter.strokePath(path, painter.pen()) # painter.drawLine(x1 + 4, y1, x2 - 4, y2) # Invisible input ports don't get a connecting dot. if y2 > h2: painter.drawLine(x2 - 4, y2, x2, y2)
def draw_connection_line(self, painter, x1, y1, x2, y2, h1, h2): # Account for list view headers. y1 += h1 y2 += h2 # Invisible output ports don't get a connecting dot. if y1 > h1: painter.drawLine(x1, y1, x1 + 4, y1) # Setup control points spline = QPolygon(4) cp = int((x2 - x1 - 8) * 0.4) spline.setPoints(x1 + 4, y1, x1 + 4 + cp, y1, x2 - 4 - cp, y2, x2 - 4, y2) # The connection line path = QPainterPath() path.moveTo(spline.at(0)) path.cubicTo(spline.at(1), spline.at(2), spline.at(3)) painter.strokePath(path, painter.pen()) # painter.drawLine(x1 + 4, y1, x2 - 4, y2) # Invisible input ports don't get a connecting dot. if y2 > h2: painter.drawLine(x2 - 4, y2, x2, y2)