E5Graphics/E5ArrowItem.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
15 NormalArrow = 1 15 NormalArrow = 1
16 WideArrow = 2 16 WideArrow = 2
17 17
18 ArrowheadAngleFactor = 0.26179938779914941 # 0.5 * atan(sqrt(3.0) / 3.0) 18 ArrowheadAngleFactor = 0.26179938779914941 # 0.5 * atan(sqrt(3.0) / 3.0)
19 19
20
20 class E5ArrowItem(QAbstractGraphicsShapeItem): 21 class E5ArrowItem(QAbstractGraphicsShapeItem):
21 """ 22 """
22 Class implementing an arrow graphics item subclass. 23 Class implementing an arrow graphics item subclass.
23 """ 24 """
24 def __init__(self, origin = QPointF(), end = QPointF(), 25 def __init__(self, origin=QPointF(), end=QPointF(),
25 filled = False, type = NormalArrow, parent = None): 26 filled=False, type=NormalArrow, parent=None):
26 """ 27 """
27 Constructor 28 Constructor
28 29
29 @param origin origin of the arrow (QPointF) 30 @param origin origin of the arrow (QPointF)
30 @param end end point of the arrow (QPointF) 31 @param end end point of the arrow (QPointF)
90 return QRectF(self._origin, QSizeF(self._end.x() - self._origin.x(), 91 return QRectF(self._origin, QSizeF(self._end.x() - self._origin.x(),
91 self._end.y() - self._origin.y()))\ 92 self._end.y() - self._origin.y()))\
92 .normalized()\ 93 .normalized()\
93 .adjusted(-extra, -extra, extra, extra) 94 .adjusted(-extra, -extra, extra, extra)
94 95
95 def paint(self, painter, option, widget = None): 96 def paint(self, painter, option, widget=None):
96 """ 97 """
97 Public method to paint the item in local coordinates. 98 Public method to paint the item in local coordinates.
98 99
99 @param painter reference to the painter object (QPainter) 100 @param painter reference to the painter object (QPainter)
100 @param option style options (QStyleOptionGraphicsItem) 101 @param option style options (QStyleOptionGraphicsItem)

eric ide

mercurial