fix click bug on removable ROIs; test (#1804)

This commit is contained in:
Martin Chase 2021-05-26 17:14:08 -07:00 committed by GitHub
parent 7bc5f215c0
commit 1735effea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -801,7 +801,7 @@ class ROI(GraphicsObject):
if ev.button() == QtCore.Qt.RightButton and self.contextMenuEnabled():
self.raiseContextMenu(ev)
ev.accept()
elif ev.button() in self.acceptedMouseButtons():
elif ev.button() & self.acceptedMouseButtons() > 0:
ev.accept()
self.sigClicked.emit(self, ev)
else:

View File

@ -153,6 +153,24 @@ def check_getArrayRegion(roi, name, testResize=True, transpose=False):
win.hide()
def test_mouseClickEvent():
plt = pg.GraphicsView()
plt.show()
resizeWindow(plt, 200, 200)
vb = pg.ViewBox()
plt.scene().addItem(vb)
vb.resize(200, 200)
QtTest.QTest.qWaitForWindowExposed(plt)
QtTest.QTest.qWait(100)
roi = pg.RectROI((0, 0), (10, 20), removable=True)
vb.addItem(roi)
app.processEvents()
mouseClick(plt, roi.mapToScene(pg.Point(2, 2)), QtCore.Qt.LeftButton)
def test_PolyLineROI():
rois = [
(pg.PolyLineROI([[0, 0], [10, 0], [0, 15]], closed=True, pen=0.3), 'closed'),