예제 #1
0
    def mouseReleaseEvent(self, event: QGraphicsSceneMouseEvent):
        """because :class:`GridSelectionGroup` has the flag
        ``QGraphicsItem.ItemIsMovable`` we need only get the position of the
        item to figure out what to submit to the model

        Args:
            event: the mouse event
        """
        MOVE_THRESHOLD = 0.01  # ignore small moves
        # print("mouse mouseReleaseEvent", self.tool.individual_pick)
        if not self.tool.individual_pick and event.button() == Qt.LeftButton:
            delta = self.pos() - self.drag_start_position
            dx, dy = delta.x(), delta.y()
            # print(abs(dx), abs(dy))
            if abs(dx) > MOVE_THRESHOLD or abs(dy) > MOVE_THRESHOLD:
                # print("finalizling", dx, dy)
                self.tool.moveSelection(dx, dy, True)
        self.tool.individual_pick = False
        return QGraphicsItemGroup.mouseReleaseEvent(self, event)
예제 #2
0
    def mouseReleaseEvent(self, event: QGraphicsSceneMouseEvent):
        """because :class:`GridSelectionGroup` has the flag
        ``QGraphicsItem.ItemIsMovable`` we need only get the position of the
        item to figure out what to submit to the model

        Args:
            event: the mouse event
        """
        MOVE_THRESHOLD = 0.01   # ignore small moves
        # print("mouse mouseReleaseEvent", self.tool.individual_pick)
        if not self.tool.individual_pick and event.button() == Qt.LeftButton:
            delta = self.pos() - self.drag_start_position
            dx, dy = delta.x(), delta.y()
            # print(abs(dx), abs(dy))
            if abs(dx) > MOVE_THRESHOLD or abs(dy) > MOVE_THRESHOLD:
                # print("finalizling", dx, dy)
                self.tool.moveSelection(dx, dy, True)
        self.tool.individual_pick = False
        return QGraphicsItemGroup.mouseReleaseEvent(self, event)