def mouseReleaseEvent(self, event_data: QMouseEvent):
     if self._ignoring_mouse_events:
         return
     if 0 <= event_data.x() <= self.width() and 0 <= event_data.y(
     ) <= self.height():
         event_data.accept()
         self.set_checked(not self.is_checked)
Beispiel #2
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
Beispiel #3
0
 def mouseMoveEvent(self, event: QMouseEvent) -> None:
     if self.is_dragging_to_select:
         offset = self.xy_to_offset(event.x(), event.y())
         if offset is not None:
             self.signal_selection_updated.emit(offset)