def mouseMoveEvent(self, event): """Summary Args: event (TYPE): Description Returns: TYPE: Description """ if self._drag_enable is True: # map the item to the scene coordinates # to help keep coordinates uniform rf = self.getR(self.mapFromScene(QPointF(event.scenePos()))) # for some reason we need to skip the first mouseMoveEvent if self._dragged is False: self._dragged = True self._r0 = rf # end if else: delta = self.selectionbox.delta(rf, self._r0) self.translateR(delta) # logger.debug('mouse move path selectionbox', delta, rf, self._r0) # end else self._r = rf # end if else: QGraphicsItemGroup.mouseMoveEvent(self, event)
def mouseMoveEvent(self, event): """Summary Args: event (TYPE): Description Returns: TYPE: Description """ if self._drag_enable is True: # map the item to the scene coordinates # to help keep coordinates uniform rf = self.getR(self.mapFromScene(QPointF(event.scenePos()))) # for some reason we need to skip the first mouseMoveEvent if self._dragged is False: self._dragged = True self._r0 = rf # end if else: delta = self.selectionbox.delta(rf, self._r0) self.translateR(delta) # print("mouse move path selectionbox", delta, rf, self._r0) # end else self._r = rf # end if else: QGraphicsItemGroup.mouseMoveEvent(self, event)
def mouseMoveEvent(self, event): if self._drag_enable == True: # map the item to the scene coordinates # to help keep coordinates uniform rf = self.getR(self.mapFromScene(QPointF(event.scenePos()))) # for some reason we need to skip the first mouseMoveEvent if self._dragged == False: self._dragged = True self._r0 = rf # end if else: delta = self.selectionbox.delta(rf, self._r0) self.translateR(delta) # end else self._r = rf # end if else: QGraphicsItemGroup.mouseMoveEvent(self, event)
def mouseMoveEvent(self, event: QGraphicsSceneMouseEvent): """because :class:`GridSelectionGroup` has the flag ``QGraphicsItem.ItemIsMovable`` we need only get the position of the item to figure out what to submit to the model Args: event: the mouse evenet """ # 1. call this super class method first to get the item position updated res = QGraphicsItemGroup.mouseMoveEvent(self, event) # watch out for bugs here? everything seems OK for now, but # could be weird window switching edge cases if not self.tool.individual_pick and event.buttons() == Qt.LeftButton: new_pos = self.pos() delta = new_pos - self.drag_last_position self.drag_last_position = new_pos dx, dy = delta.x(), delta.y() self.tool.moveSelection(dx, dy, False, use_undostack=False) return res