Exemplo n.º 1
0
 def __createRubberBand(self, event):
     """Creates the rubber band rectangle and shows it"""
     self.lmbOrigin = event.scenePos().toPoint()
     self.rubberBand = RubberBandItem(self.parent().cflowSettings)
     self.addItem(self.rubberBand)
     self.rubberBand.setGeometry(QRect(self.lmbOrigin, QSize()))
     self.rubberBand.hide()
Exemplo n.º 2
0
 def __createRubberBand(self, event):
     """Creates the rubber band rectangle and shows it"""
     # Canvas == None means that there is no module item on the canvas
     # which is a case when there is exactly nothing drawn. The only
     # possiblity is that a broken file was open so there is nothing to
     # select anyway
     canvas = self.__getCanvas()
     if canvas is not None:
         self.lmbOrigin = event.scenePos().toPoint()
         self.rubberBand = RubberBandItem(canvas)
         self.addItem(self.rubberBand)
         self.rubberBand.setGeometry(QRect(self.lmbOrigin, QSize()))
         self.rubberBand.hide()
Exemplo n.º 3
0
 def mouseMoveEvent(self, event):
     """Handles mouse movement"""
     if self.lmbOrigin and self.rubberBand:
         # Draw the rubber band selection rectangle
         rect = QRect(self.lmbOrigin, event.scenePos().toPoint())
         self.rubberBand.setGeometry(rect.normalized())
         if not self.__isRubberBandVisible():
             if abs(rect.left() - rect.right()) >= RUBBER_BAND_MIN_SIZE or \
                abs(rect.top() - rect.bottom()) >= RUBBER_BAND_MIN_SIZE:
                 self.rubberBand.show()
     QGraphicsScene.mouseMoveEvent(self, event)
Exemplo n.º 4
0
 def __createRubberBand(self, event):
     self.rubberBand = RubberBandItem()
     self.addItem(self.rubberBand)
     self.origin = event.scenePos().toPoint()
     self.rubberBand.setGeometry(QRect(self.origin, QSize()))
     self.rubberBand.show()
Exemplo n.º 5
0
 def mouseMoveEvent(self, event):
     if self.origin is not None:
         if self.rubberBand:
             rect = QRect(self.origin, event.scenePos().toPoint())
             self.rubberBand.setGeometry(rect.normalized())
     QGraphicsScene.mouseMoveEvent(self, event)