예제 #1
0
 def mousePressEvent(self, event):
     QGraphicsItem.mousePressEvent(self, event)
     self.mousePressPos = event.scenePos()
     self.lastNodePos = self.scenePos()
     pBottomRight = self.rect.bottomRight()
     bottomRightRect = QtCore.QRectF(pBottomRight.x() - 6,
                                     pBottomRight.y() - 6, 5, 5)
     # detect where on the node
     if bottomRightRect.contains(event.pos()) and self.expanded:
         self.initialRectWidth = self.rect.width()
         self.initialRectHeight = self.rect.height()
         self.resizeDirection = (1, 1)
         self.setFlag(QGraphicsItem.ItemIsMovable, False)
         self.bResize = True
     elif event.pos().x() > (self.rect.width() - 20) and self.expanded:
         self.initialRectWidth = self.rect.width()
         self.resizeDirection = (1, 0)
         self.setFlag(QGraphicsItem.ItemIsMovable, False)
         self.bResize = True
     elif (event.pos().y() + self.label().defaultHeight) > (
             self.rect.height() - 30) and self.expanded:
         self.initialRectHeight = self.rect.height()
         self.resizeDirection = (0, 1)
         self.setFlag(QGraphicsItem.ItemIsMovable, False)
         self.bResize = True
     if self.expanded:
         self.nodesToMove.clear()
         self.updateChildrens(self.collidingItems())
     else:
         nodes = []
         for nodename in self.nodesNamesToMove:
             nodes.append(self.graph().nodes[nodename])
         self.updateChildrens(nodes)
예제 #2
0
 def mousePressEvent(self, event):
     self.update()
     # self.setCursor(QtCore.Qt.ClosedHandCursor)
     QGraphicsItem.mousePressEvent(self, event)
예제 #3
0
 def mousePressEvent(self, event):
     self.update()
     QGraphicsItem.mousePressEvent(self, event)
     self._current_pos = self.pos()