Ejemplo n.º 1
0
 def _radius_from_point_and_angle(self, point, angle):
     line = QLineF()
     line.setP1(point)
     line.setAngle(angle)
     normal = line.normalVector()
     normal.setLength(self.magic_number / 2)
     return QPointF(normal.dx(), normal.dy())
Ejemplo n.º 2
0
 def update_line(self):
     overlapping_arcs = [
         arc for arc in self.rel_item.arc_items
         if arc.obj_item == self.obj_item
     ]
     count = len(overlapping_arcs)
     path = QPainterPath(self.rel_item.pos())
     if count == 1:
         path.lineTo(self.obj_item.pos())
     else:
         rank = overlapping_arcs.index(self)
         line = QLineF(self.rel_item.pos(), self.obj_item.pos())
         line.setP1(line.center())
         line = line.normalVector()
         line.setLength(self._width * count)
         line.setP1(2 * line.p1() - line.p2())
         t = rank / (count - 1)
         ctrl_point = line.pointAt(t)
         path.quadTo(ctrl_point, self.obj_item.pos())
     self.setPath(path)