Ejemplo n.º 1
0
 def mouseReleaseEvent(self, event):
     """If panning, stop. If handles were pressed, release them."""
     if self._transform_enable == True:
         # QMouseEvent.button() returns the button that triggered the event
         which_button = event.button()
         if which_button in [self._button_pan, self._button_pan_alt]:
             self._panDisable()
         elif which_button == self._button_zoom:
             self._dolly_zoom_enable = False
         else:
             return QGraphicsView.mouseReleaseEvent(self, event)
     # end if
     else:
         if len(self._press_list):  # Notify any pressed items to release
             event_pos = event.pos()
             for item in self._press_list:
                 #try:
                 # print("item release", item)
                 item.customMouseRelease(event)
                 #except:
                 #    item.mouseReleaseEvent(event)
             #end for
             self._press_list = []
         # end if
         if self._selection_lock:
             self._selection_lock.processPendingToAddList()
         return QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 2
0
    def mouseReleaseEvent(self, event):
        QGraphicsView.mouseReleaseEvent(self, event)

        if not self.fPanning:
            return

        self.fPanning = False
        self.setDragMode(QGraphicsView.NoDrag)
        self.setCursor(QCursor(Qt.ArrowCursor))
Ejemplo n.º 3
0
 def inputGraphicsViewMouseReleaseEvent(self, event):
     if self.drawingFlag == True:
         self.drawingFlag = False
         self.videoPlaybackWidget.playButtonClicked()
     self.handInputSystem.inputMouseReleaseEvent()
     self.handInputSystem.setPoints()
     # Comment out to permit the view for sending the event to the child scene.
     QGraphicsView.mouseReleaseEvent(self.inputGraphicsView, event)
     self.inputGraphicsView.viewport().setCursor(QtCore.Qt.ArrowCursor)
Ejemplo n.º 4
0
    def mouseReleaseEvent(self, event):
        if self.bResizing: ## stop resizing
            self.bResizing = False
            r = self.resizingArea.rect()

            ## set min size
            self.resizingArea.setRect(0, 0, max(r.width(),
                2*OcrArea.resizeBorder), max(r.height(),
                2*OcrArea.resizeBorder))
            self.resizingArea.setFlag(QGraphicsItem.ItemIsMovable,
                True)

        QGraphicsView.mouseReleaseEvent(self, event)
 def mouseReleaseEvent(self, event):
     """ Stop mouse pan or zoom mode (apply zoom if valid).
     """
     QGraphicsView.mouseReleaseEvent(self, event)
     scenePos = self.mapToScene(event.pos())
     if event.button() == Qt.LeftButton:
         self.setDragMode(QGraphicsView.NoDrag)
         self.leftMouseButtonReleased.emit(scenePos.x(), scenePos.y())
     elif event.button() == Qt.RightButton:
         if self.canZoom:
             viewBBox = self.zoomStack[-1] if len(self.zoomStack) else self.sceneRect()
             selectionBBox = self.scene.selectionArea().boundingRect().intersected(viewBBox)
             self.scene.setSelectionArea(QPainterPath())  # Clear current selection area.
             if selectionBBox.isValid() and (selectionBBox != viewBBox):
                 self.zoomStack.append(selectionBBox)
                 self.updateViewer()
         self.setDragMode(QGraphicsView.NoDrag)
         self.rightMouseButtonReleased.emit(scenePos.x(), scenePos.y())
Ejemplo n.º 6
0
 def mouseReleaseEvent(self, event):
     """ Stop mouse pan or zoom mode (apply zoom if valid).
     """
     QGraphicsView.mouseReleaseEvent(self, event)
     scenePos = self.mapToScene(event.pos())
     if event.button() == Qt.LeftButton:
         self.setDragMode(QGraphicsView.NoDrag)
         self.leftMouseButtonReleased.emit(scenePos.x(), scenePos.y())
     elif event.button() == Qt.RightButton:
         if self.canZoom:
             viewBBox = self.zoomStack[-1] if len(
                 self.zoomStack) else self.sceneRect()
             selectionBBox = self.scene.selectionArea().boundingRect(
             ).intersected(viewBBox)
             self.scene.setSelectionArea(
                 QPainterPath())  # Clear current selection area.
             if selectionBBox.isValid() and (selectionBBox != viewBBox):
                 self.zoomStack.append(selectionBBox)
                 self.updateViewer()
         self.setDragMode(QGraphicsView.NoDrag)
         self.rightMouseButtonReleased.emit(scenePos.x(), scenePos.y())
Ejemplo n.º 7
0
 def mouseReleaseEvent(self, event):
     """If panning, stop. If handles were pressed, release them."""
     if self._transform_enable:
         # QMouseEvent.button() returns the button that triggered the event
         which_button = event.button()
         if which_button in [self._button_pan, self._button_pan_alt]:
             self._panDisable()
         elif which_button == self._button_zoom:
             self._dolly_zoom_enable = False
         else:
             return QGraphicsView.mouseReleaseEvent(self, event)
     # end if
     else:
         if len(self._press_list):  # Notify any pressed items to release
             # event_pos = event.pos()
             for item in self._press_list:
                 item.customMouseRelease(event)
             self._press_list = []
         # end if
         if self._selection_lock:
             self._selection_lock.processPendingToAddList()
         return QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 8
0
    def mouseReleaseEvent(self, event):
        QGraphicsView.mouseReleaseEvent(self, event)
        scenePos = self.mapToScene(event.pos())
        self.mouseReleaseLoc.emit(scenePos.x(), scenePos.y())
        self.release = scenePos.toPoint()
        if event.button() == Qt.LeftButton:
            self.setDragMode(QGraphicsView.NoDrag)
        elif event.button() == Qt.RightButton:
            r = self.sceneRect()
            a = self.scene.selectionArea()
            box = a.boundingRect().intersected(r)
            rl = int(floor(box.left()))
            rr = int(ceil(box.right()))
            rt = int(floor(box.top()))
            rb = int(ceil(box.bottom()))
            self.box = QRect(rl, rt, rr - rl, rb - rt)
            self.boxf = box

            if self.mode == "view":
                self.fitWindow(self.boxf)
            else:
                self.selBox.emit(self.mode)
            self.setDragMode(QGraphicsView.NoDrag)
Ejemplo n.º 9
0
    def mouseReleaseEvent(self, event):

        QGraphicsView.mouseReleaseEvent(self, event)

        if event.button() == Qt.LeftButton:
            self.setDragMode(QGraphicsView.NoDrag)
Ejemplo n.º 10
0
 def mouseReleaseEvent(self, event):
     self.setDragMode(QGraphicsView.NoDrag)
     QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 11
0
    def mouseReleaseEvent(self, event):
        if event.button() & Qt.LeftButton:
            self.__stopAutoScroll()

        return QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 12
0
 def accept_mouseRelease(self, event):
     if self.hasImage():
         QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 13
0
 def mouseReleaseEvent(self, e):
     logger.debug('mouseReleaseEvent')
     QGraphicsView.mouseReleaseEvent(self, e)
     if self.click_pos is not None:
         self.click_pos = None
Ejemplo n.º 14
0
 def mouseReleaseEvent(self, event):
     if self.hasImage():
         self.mouseButtonRelease.emit(event)  #发送鼠标左键释放信号
     QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 15
0
 def mouseReleaseEvent(self, event):
     QGraphicsView.mouseReleaseEvent(self, event)
     pos = self.mapToScene(event.pos())
     if event.button() == Qt.LeftButton:
         self.setDragMode(QGraphicsView.NoDrag)
     self.leftMouseButtonPressed.emit(pos.x(), pos.y())
Ejemplo n.º 16
0
 def mouseReleaseEvent(self, event):
     modifiers = QApplication.keyboardModifiers()
     if modifiers == QtCore.Qt.ShiftModifier:
         self.rubber_band_changable = False
     else:
         QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 17
0
 def mouseReleaseEvent(self, event):
     self._pan_from = None
     self.setCursor(Qt.ArrowCursor)
     QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 18
0
 def mouseReleaseEvent(self, event):
     self.setDragMode(QGraphicsView.NoDrag)
     QGraphicsView.mouseReleaseEvent(self, event)