def hoverMoveEvent(self, event): self.last_mouse_position = self.translateEventCoordinates(event) tool = self._getActiveTool() tool_method_name = tool.methodPrefix() + "HoverMove" if hasattr(self, tool_method_name): getattr(self, tool_method_name)(tool, event) else: event.setAccepted(False) QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event): mapped_position = self.griditem.mapFromScene(event.scenePos()) self.last_mouse_position = (mapped_position.x(), mapped_position.y()) tool = self._getActiveTool() tool_method_name = tool.methodPrefix() + "HoverMove" if hasattr(self, tool_method_name): getattr(self, tool_method_name)(tool, event) else: event.setAccepted(False) QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event: QGraphicsSceneHoverEvent): """Summary Args: event: Description """ tool = self._getActiveTool() tool_method_name = tool.methodPrefix() + "HoverMove" if hasattr(self, tool_method_name): getattr(self, tool_method_name)(tool, event) else: event.setAccepted(False) QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event: QGraphicsSceneHoverEvent): """Summary Args: event: Description """ tool = self._getActiveTool() tool_method_name = tool.methodPrefix() + "HoverMove" if hasattr(self, tool_method_name): getattr(self, tool_method_name)(tool, event) else: event.setAccepted(False) QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event): """ called when mouse hovers over Timeable, sets the cursor according to the position of the mouse and shows timeable name """ if not self.name_visible: self.setToolTip("<font color=\"#000000\">" + self.name + "</font>") # get handle at current position handle = self.handle_at(event.pos()) # set the cursor according to the handle cursor = Qt.OpenHandCursor if handle == HANDLE_MIDDLE else Qt.SizeHorCursor self.setCursor(cursor) QGraphicsItem.hoverMoveEvent(self, event)
def createToolHoverMove(self, tool: AbstractGridToolT, event: QGraphicsSceneHoverEvent): """Summary Args: tool: Description event: Description """ tool.hoverMoveEvent(self, event) return QGraphicsItem.hoverMoveEvent(self, event)
def createToolHoverMove(self, tool: AbstractGridToolT, event: QGraphicsSceneHoverEvent): """Summary Args: tool: Description event: Description """ tool.hoverMoveEvent(self, event) return QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event): """Summary Args: event (TYPE): Description Args: TYPE: Description """ # print("Slice VHI hoverMoveEvent") self.vhi_hint_item.setPos(event.pos()-QPointF(_RADIUS-DELTA, _RADIUS-DELTA)) tool = self._getActiveTool() tool_method_name = tool.methodPrefix() + "HoverMove" if hasattr(self, tool_method_name): getattr(self, tool_method_name)(tool, event) else: event.setAccepted(False) QGraphicsItem.hoverMoveEvent(self, event)
def createToolHoverMove(self, tool, event): """Summary Args: tool (TYPE): Description event (TYPE): Description Returns: TYPE: Description """ tool.hoverMoveEvent(self, event) return QGraphicsItem.hoverMoveEvent(self, event)
def createToolHoverMove(self, tool, event): """Summary Args: tool (TYPE): Description event (TYPE): Description Returns: TYPE: Description """ event_xy = self.translateEventCoordinates(event) event_coord = ShortestPathHelper.findClosestPoint( event_xy, self.coordinates_to_xy) is_alt = True if event.modifiers() & Qt.AltModifier else False self.last_mouse_position = event_xy # Un-highlight GridItems if necessary by calling createToolHoverLeave if len(self._highlighted_path) > 1 or ( self._highlighted_path and self._highlighted_path[0] != event_coord): self.createToolHoverLeave(tool=tool, event=event) # Highlight GridItems if alt is being held down if is_alt and self.shortest_path_add_mode and self._inPointItem( event_xy, event_coord): self._preview_spa(event_xy) else: point_item = self.coordinates_to_xy.get(event_coord) if point_item is not None and self._inPointItem( event_xy, event_coord) and is_alt: self.highlightOneGridPoint(self.getLastHoveredCoordinates(), styles.SPA_START_HINT_COLOR) elif point_item is not None and self._inPointItem( event_xy, event_coord) and not is_alt: part = self._model_part next_idnums = (part._getNewIdNum(0), part._getNewIdNum(1)) self.griditem.showCreateHint(event_coord, next_idnums=next_idnums) self._highlighted_path.append(event_coord) tool.hoverMoveEvent(self, event) return QGraphicsItem.hoverMoveEvent(self, event)
def hoverLeaveEvent(self, event): self.setBrush(QBrush(Qt.black)) self.log.notHovered.emit() QGraphicsItem.hoverMoveEvent(self, event)
def hoverEnterEvent(self, event): self.setBrush(QBrush(Qt.red)) self.log.hovered.emit() QGraphicsItem.hoverMoveEvent(self, event)
def createToolHoverMove(self, tool, event): """Summary Args: tool (TYPE): Description event (TYPE): Description Returns: TYPE: Description """ is_alt = True if event.modifiers() & Qt.AltModifier else False mapped_position = self.griditem.mapFromScene(event.scenePos()) event_xy = (mapped_position.x(), mapped_position.y()) if self.griditem.grid_type is GridType.HONEYCOMB: event_coord = HoneycombDnaPart.positionModelToLatticeCoord( DEFAULT_RADIUS, event_xy[0], event_xy[1], scale_factor=self.scale_factor, strict=True) elif self.griditem.grid_type is GridType.SQUARE: event_coord = SquareDnaPart.positionModelToLatticeCoord( DEFAULT_RADIUS, event_xy[0], event_xy[1], scale_factor=self.scale_factor, strict=True) else: event_coord = None self.last_mouse_position = event_xy if event_coord: try: grid_point = self.griditem.points_dict[(event_coord)] self.setLastHoveredItem(grid_point) except KeyError: pass # Un-highlight GridItems if necessary by calling createToolHoverLeave if len(self._highlighted_path) > 1 or ( self._highlighted_path and self._highlighted_path[0] != event_coord): self.removeAllCreateHints() self._highlighted_grid_point = event_coord if event_coord: self.griditem.highlightGridPoint(row=event_coord[0], column=event_coord[1], on=True) # Highlight GridItems if alt is being held down if is_alt and self.shortest_path_add_mode and event_coord is not None: self._previewSpa(event_xy) else: if is_alt and event_coord is not None: self.highlightOneGridPoint(self.getLastHoveredCoordinates(), styles.SPA_START_HINT_COLOR) elif not is_alt and event_coord is not None: part = self._model_part next_idnums = (part._getNewIdNum(0), part._getNewIdNum(1)) self.griditem.showCreateHint(event_coord, next_idnums=next_idnums) self._highlighted_path.append(event_coord) tool.hoverMoveEvent(self, event) return QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event: QGraphicsSceneHoverEvent): if event.modifiers() & Qt.ShiftModifier: self.setCursor(Qt.OpenHandCursor) else: self.setCursor(Qt.ArrowCursor) QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event: QGraphicsSceneHoverEvent): if event.modifiers() & Qt.ShiftModifier: self.setCursor(Qt.OpenHandCursor) else: self.setCursor(Qt.ArrowCursor) QGraphicsItem.hoverMoveEvent(self, event)
def hoverMoveEvent(self, event): QGraphicsItem.hoverMoveEvent(self, event)