예제 #1
0
    def mousePressEvent(self, event: QtGui.QMouseEvent):
        """
        Event for pressing certain mouse buttons on this widget

        """
        if event.button() == QtCore.Qt.MouseButton.RightButton:
            self._signalSenderPressed.sgn2adder.emit([self._x, self._y])
예제 #2
0
 def mouseReleaseEvent(
         self,
         event: QMouseEvent
 ) -> None:
     if event.button() == Qt.LeftButton:
         self.func()
     super().mouseReleaseEvent(event)
예제 #3
0
    def mouseReleaseEvent(self, event: QtGui.QMouseEvent):
        if event.button() == QtCore.Qt.MouseButton.MiddleButton:
            index = self.indexAt(event.pos())
            model = index.model()
            if model:
                self.middle_clicked.emit(index)
                return

        super().mouseReleaseEvent(event)
예제 #4
0
    def mouseReleaseEvent(self, event: QMouseEvent):
        super().mouseReleaseEvent(event)
        if self._state == State.PANNING:
            if event.button() == Qt.RightButton:
                self._state = State.IDLE
        elif self._state == State.SELECTING:
            if event.button() == Qt.LeftButton:
                self._state = State.IDLE
                if self.GetSelectionMode() is SelectionMode.MODIFY:
                    for item in self._hoveredItems:
                        self.ToggleSelectItem(item)
                else:
                    self.DeselectAll()
                    for item in self._hoveredItems:
                        self.SelectItem(item)
                self.selectionChanged.emit(self._selectedItems)
        elif self._state == State.MOVING:
            if event.button() == Qt.LeftButton:
                self._state = State.IDLE

        self.UpdateView()

        super().mouseReleaseEvent(event)
예제 #5
0
    def mousePressEvent(self, event: QMouseEvent) -> None:
        if event.button() == Qt.LeftButton:

            # TODO handle click on label, etc
            offset = self.xy_to_offset(event.x(), event.y())
            if offset is not None:

                ctrl = event.modifiers(
                ) & Qt.ControlModifier == Qt.ControlModifier
                shift = event.modifiers(
                ) & Qt.ShiftModifier == Qt.ShiftModifier

                if ctrl:
                    # Go to pointer
                    self.signal_go_to_pointer_at_offset.emit(offset)
                    return

                if shift:
                    # Move selection instead of cursor
                    self.signal_selection_updated.emit(offset)
                    self.is_dragging_to_select = True
                    return
                self.signal_cursor_changed.emit(offset)
                self.is_dragging_to_select = True
예제 #6
0
 def mousePressEvent(self, event: QMouseEvent) -> None:  # pylint: disable=invalid-name
     """Event handler for mouse button presses."""
     if event.button() == Qt.MouseButton.ForwardButton:
         self.next()
     elif event.button() == Qt.MouseButton.BackButton:
         self.previous()