Exemple #1
0
    def mouseMoveEvent(self, event: QMouseEvent):
        # Move is only triggered with left mouse button pressed
        if event.buttons() == Qt.LeftButton:
            self.setCursor(QCursor(Qt.ClosedHandCursor))
            global_position = event.globalPos()
            diff = global_position - self._mouse_move_pos

            self._notify(SplineHandleWidgetMoveEvent(self, diff.x(), diff.y()))
            self._mouse_move_pos = global_position
Exemple #2
0
 def mouseMoveEvent(self, event: Qt.QMouseEvent) -> None:
     super().mouseMoveEvent(event)
     for toolbar, notches in self.toolbars_notches.items():
         if not toolbar.is_notches_visible():
             continue
         for notch in notches:
             line = notch.line
             if line.x1() - 0.5 <= event.x() <= line.x1() + 0.5:
                 Qt.QToolTip.showText(event.globalPos(), notch.label)
                 return
    def mousePressEvent(self, event: QMouseEvent):
        logger.debug("MousePressEvent")
        if event.buttons() == Qt.LeftButton:
            self.__mouse_press_pos = event.globalPos()
            self.__command_handler.start_script()

            if event.modifiers() == Qt.AltModifier:
                self.__rubber_band.setGeometry(
                    QRect(self.__mouse_press_pos, QSize()))
                self.__rubber_band.show()
                self.__clear_selection()
 def mouseMoveEvent(self, event: QMouseEvent):
     if self.__mouse_press_pos is not None:
         global_position = event.globalPos()
         diff = global_position - self.__mouse_press_pos
         if self.__rubber_band.isVisible():
             self.__rubber_band.setGeometry(
                 QRect(self.mapFromGlobal(self.__mouse_press_pos),
                       event.pos()).normalized())
             # Add to selection if inside rubber band remove otherwise
             for widget in self.__model_widget_map.values():
                 if self.__rubber_band.geometry().contains(
                         widget.geometry()):
                     self.__add_selection(widget)
                 else:
                     self.__remove_selection(widget)
         else:
             self.setCursor(QtGui.QCursor(QtCore.Qt.ClosedHandCursor))
             self.__grid_offset += diff
             self.__grid.set_offset(self.__grid_offset)
             self.__grid_widget.set_offset(self.__grid_offset)
             self.__grid_widget.repaint()
             self.__model.move_graph_relative(diff.x(), diff.y())
             self.__mouse_press_pos = global_position
Exemple #5
0
 def __init__(self, widget: GraphItem, mouse_event: QMouseEvent, *args,
              **kwargs):
     super().__init__(widget, mouse_event.globalPos(), mouse_event, *args,
                      **kwargs)