def mousePressEvent(self, event):
super(HomographyScene, self).mousePressEvent(event)
loc = (event.scenePos().x(), event.scenePos().y())
clicked_point, cp_index = self.find_clicked_point(loc)
if clicked_point:
if event.button() == Qt.RightButton: # Right click to delete points
self.delete_point(clicked_point, cp_index)
else: # Note that we are currently moving a point
self.point_selected = True
self.selected_point = clicked_point
self.selected_point.setCursor(self.parent().cursor_drag)
else: # Otherwise add a new point
if self.main_pixmap_item.isUnderMouse(): # Check to make sure we're in the image.
self.add_point(loc)
评论列表
文章目录