From 10c1e83cd723d252f4cd2f4f5e29d09e36540da7 Mon Sep 17 00:00:00 2001 From: Christopher Mullins Date: Tue, 13 Apr 2021 22:02:30 -0700 Subject: [PATCH] Expose the `clickable` property of `PlotDataItem`. (#519) * Fix the `clickable` property of `PlotDataItem`. Currently if you attempt to set the `clickable` property of a PlotDataItem, this property is silently ignored. The expected behavior is to set the `clickable` property of the underlying PlotCurveItem. * Use setCurvesClickable and curvesClickable instead * curve is singular --- pyqtgraph/graphicsItems/PlotDataItem.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py index 5c35f160..2c07798b 100644 --- a/pyqtgraph/graphicsItems/PlotDataItem.py +++ b/pyqtgraph/graphicsItems/PlotDataItem.py @@ -208,6 +208,7 @@ class PlotDataItem(GraphicsObject): 'data': None, } + self.setCurveClickable(kargs.get('clickable', False)) self.setData(*args, **kargs) def implements(self, interface=None): @@ -219,6 +220,12 @@ class PlotDataItem(GraphicsObject): def name(self): return self.opts.get('name', None) + def setCurveClickable(self, s, width=None): + self.curve.setClickable(s, width) + + def curveClickable(self): + return self.curve.clickable + def boundingRect(self): return QtCore.QRectF() ## let child items handle this