Added some documentation for ArrowItem
This commit is contained in:
parent
738fc7e233
commit
e71a2d4b23
@ -12,6 +12,10 @@ class ArrowItem(QtGui.QGraphicsPathItem):
|
|||||||
|
|
||||||
|
|
||||||
def __init__(self, **opts):
|
def __init__(self, **opts):
|
||||||
|
"""
|
||||||
|
Arrows can be initialized with any keyword arguments accepted by
|
||||||
|
the setStyle() method.
|
||||||
|
"""
|
||||||
QtGui.QGraphicsPathItem.__init__(self, opts.get('parent', None))
|
QtGui.QGraphicsPathItem.__init__(self, opts.get('parent', None))
|
||||||
if 'size' in opts:
|
if 'size' in opts:
|
||||||
opts['headLen'] = opts['size']
|
opts['headLen'] = opts['size']
|
||||||
@ -40,6 +44,32 @@ class ArrowItem(QtGui.QGraphicsPathItem):
|
|||||||
self.moveBy(*self.opts['pos'])
|
self.moveBy(*self.opts['pos'])
|
||||||
|
|
||||||
def setStyle(self, **opts):
|
def setStyle(self, **opts):
|
||||||
|
"""
|
||||||
|
Changes the appearance of the arrow.
|
||||||
|
All arguments are optional:
|
||||||
|
|
||||||
|
================= =================================================
|
||||||
|
Keyword Arguments
|
||||||
|
angle Orientation of the arrow in degrees. Default is
|
||||||
|
0; arrow pointing to the left.
|
||||||
|
headLen Length of the arrow head, from tip to base.
|
||||||
|
default=20
|
||||||
|
headWidth Width of the arrow head at its base.
|
||||||
|
tipAngle Angle of the tip of the arrow in degrees. Smaller
|
||||||
|
values make a 'sharper' arrow. If tipAngle is
|
||||||
|
specified, ot overrides headWidth. default=25
|
||||||
|
baseAngle Angle of the base of the arrow head. Default is
|
||||||
|
0, which means that the base of the arrow head
|
||||||
|
is perpendicular to the arrow shaft.
|
||||||
|
tailLen Length of the arrow tail, measured from the base
|
||||||
|
of the arrow head to the tip of the tail. If
|
||||||
|
this value is None, no tail will be drawn.
|
||||||
|
default=None
|
||||||
|
tailWidth Width of the tail. default=3
|
||||||
|
pen The pen used to draw the outline of the arrow.
|
||||||
|
brush The brush used to fill the arrow.
|
||||||
|
================= =================================================
|
||||||
|
"""
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
|
|
||||||
opt = dict([(k,self.opts[k]) for k in ['headLen', 'tipAngle', 'baseAngle', 'tailLen', 'tailWidth']])
|
opt = dict([(k,self.opts[k]) for k in ['headLen', 'tipAngle', 'baseAngle', 'tailLen', 'tailWidth']])
|
||||||
|
Loading…
Reference in New Issue
Block a user