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])
def mouseReleaseEvent( self, event: QMouseEvent ) -> None: if event.button() == Qt.LeftButton: self.func() super().mouseReleaseEvent(event)
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)
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)
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
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()