Pop the 'parent' arg from ArrowItem opts parameter dict
If not, then an `KeyError: 'Invalid arrow style option "parent"'` is raised in setStyle.
This commit is contained in:
parent
abfac52c34
commit
a9049f1d4d
@ -17,7 +17,7 @@ class ArrowItem(QtGui.QGraphicsPathItem):
|
||||
the setStyle() method.
|
||||
"""
|
||||
self.opts = {}
|
||||
QtGui.QGraphicsPathItem.__init__(self, opts.get('parent', None))
|
||||
QtGui.QGraphicsPathItem.__init__(self, opts.pop('parent', None))
|
||||
|
||||
if 'size' in opts:
|
||||
opts['headLen'] = opts['size']
|
||||
|
10
pyqtgraph/graphicsItems/tests/test_ArrowItem.py
Normal file
10
pyqtgraph/graphicsItems/tests/test_ArrowItem.py
Normal file
@ -0,0 +1,10 @@
|
||||
import pyqtgraph as pg
|
||||
|
||||
app = pg.mkQApp()
|
||||
|
||||
|
||||
def test_ArrowItem():
|
||||
parent = pg.GraphicsObject()
|
||||
a = pg.ArrowItem(parent=parent, pos=(10, 10))
|
||||
assert a.parentItem() is parent
|
||||
assert a.pos() == pg.Point(10, 10)
|
Loading…
Reference in New Issue
Block a user