Example #1
0
 def mousePressEvent(self, evt):
     # do nothing if we don't click on an item
     if not self.itemAt(evt.pos()):
         return
     # only one item can be selected at a time, so deselect if any
     for item in self.scene().selectedItems():
         item.setSelected(False)
     QGraphicsView.mousePressEvent(self, evt)
Example #2
0
 def mousePressEvent(self, event):
     """ Start mouse pan or zoom mode.
     """
     scenePos = self.mapToScene(event.pos())
     if event.button() == Qt.LeftButton:
         if self.canPan:
             self.setDragMode(QGraphicsView.ScrollHandDrag)
         self.leftMouseButtonPressed.emit(scenePos.x(), scenePos.y())
     QGraphicsView.mousePressEvent(self, event)
Example #3
0
 def mousePressEvent(self, evt):
     item = self.itemAt(evt.pos())
     # do nothing if we don't click on an item
     if not item:
         return
     # do nothing if we click on a bound
     if not (item.flags() & QGraphicsRectItem.ItemIsSelectable):
         return
     # only one item can be selected at a time, so deselect if any
     for item in self.scene().selectedItems():
         item.setSelected(False)
     QGraphicsView.mousePressEvent(self, evt)
Example #4
0
    def mousePressEvent(self, event):
        Debugger.debug('mouse press event received, point:', event.pos())

        # to catch tablet events (for some reason, it results in a mousePrEv too)
        if self.ignore_mouse_event:
            self.ignore_mouse_event = False
            return

        # there might be a proxy widget meant to receive the event instead of the flow
        QGraphicsView.mousePressEvent(self, event)

        # to catch any Proxy that received the event. Checking for event.isAccepted() or what is returned by
        # QGraphicsView.mousePressEvent(...) both didn't work so far, so I do it manually
        if self.ignore_mouse_event:
            self.ignore_mouse_event = False
            return

        if event.button() == Qt.LeftButton:
            if self.node_choice_proxy.isVisible():
                self.hide_node_choice_widget()
            else:
                if find_type_in_object(self.itemAt(event.pos()),
                                       PortInstanceGate):
                    self.gate_selected = self.itemAt(event.pos())
                    self.dragging_connection = True

            self.left_mouse_pressed_in_flow = True

        elif event.button() == Qt.RightButton:
            if len(self.items(event.pos())) == 0:
                self.node_choice_widget.reset_list()
                self.show_node_choice_widget(event.pos())

        elif event.button() == Qt.MidButton:
            self.panning = True
            self.pan_last_x = event.x()
            self.pan_last_y = event.y()
            event.accept()

        self.mouse_press_pos = self.mapToScene(event.pos())
Example #5
0
 def mousePressEvent(self, event):
     if event.button() == Qt.LeftButton:
         self.mouse_pressed = True
     QGraphicsView.mousePressEvent(self, event)
Example #6
0
	def mousePressEvent(self, mouse_event): # QMouseEvent
		if mouse_event.button() == Qt.LeftButton:
			self.setDragMode(QGraphicsView.ScrollHandDrag)
		elif mouse_event.button() == Qt.RightButton:
			self.setDragMode(QGraphicsView.RubberBandDrag)
		QGraphicsView.mousePressEvent(self, mouse_event)