diff --git a/pyqtgraph/graphicsItems/ArrowItem.py b/pyqtgraph/graphicsItems/ArrowItem.py index e0628d08..a7cc831c 100644 --- a/pyqtgraph/graphicsItems/ArrowItem.py +++ b/pyqtgraph/graphicsItems/ArrowItem.py @@ -11,13 +11,13 @@ class ArrowItem(QtGui.QGraphicsPathItem): """ - def __init__(self, **opts): + def __init__(self, parent=None, **opts): """ Arrows can be initialized with any keyword arguments accepted by the setStyle() method. """ self.opts = {} - QtGui.QGraphicsPathItem.__init__(self, opts.get('parent', None)) + QtGui.QGraphicsPathItem.__init__(self, parent) if 'size' in opts: opts['headLen'] = opts['size'] diff --git a/pyqtgraph/graphicsItems/tests/test_ArrowItem.py b/pyqtgraph/graphicsItems/tests/test_ArrowItem.py new file mode 100644 index 00000000..f85e637c --- /dev/null +++ b/pyqtgraph/graphicsItems/tests/test_ArrowItem.py @@ -0,0 +1,10 @@ +import pyqtgraph as pg + +app = pg.mkQApp() + + +def test_ArrowItem_parent(): + parent = pg.GraphicsObject() + a = pg.ArrowItem(parent=parent, pos=(10, 10)) + assert a.parentItem() is parent + assert a.pos() == pg.Point(10, 10)