def mouseDoubleClickEvent(self, event: QtGui.QMouseEvent) -> None: local_pos = QPointF(self.mapFromGlobal(event.globalPos())) local_pos -= self.get_area_canvas_offset() nodes_at_mouse = self._nodes_at_position(local_pos) if nodes_at_mouse: if len(nodes_at_mouse) == 1: self.SelectNodeRequest.emit(nodes_at_mouse[0]) return areas_at_mouse = self._other_areas_at_position(local_pos) if areas_at_mouse: if len(areas_at_mouse) == 1: self.SelectAreaRequest.emit(areas_at_mouse[0]) return
def mouseMoveEvent(self, event: QtGui.QMouseEvent) -> None: dx = event.globalX() - self.__last_pos.x() dy = event.globalY() - self.__last_pos.y() self.__last_pos = event.globalPos() self.move(self.x() + dx, self.y() + dy)
def mousePressEvent(self, event: QtGui.QMouseEvent) -> None: self.__last_pos = event.globalPos()