I have a bunch of ScatterPlotItems on a GraphicsScene and I am trying to find a way to get the one that's underneath the the mouse cursor. This is so that I can set that particular ScatterPlotItem as the active scatterplot and have other mouse event functions refer to it.
graphics_scene = self.plotwidget_graph.sceneObj
graphics_scene.sigMouseHover.connect(self.set_scatter)
graphics_scene.sigMouseClicked.connect(self.check_item)
graphics_scene.sigMouseMoved.connect(self.display_item_data)
If there's only one ScatterPlotItem, all I have to do is just get the one item in listDataItems.
def set_scatter(self, item):
plotitem = item[0]
self.active_scatter = plotitem.listDataItems()[0]
When there are more than one ScatterPlotItem though, listDataItems returns an unsorted list of ScatterPlotItems so there's no way to tell which item is the one that is directly underneath the mouse cursor. ScatterPlotItem doesn't appear to have mouse event signals so I'm not sure how to proceed.