示例#1
0
    def mouseMoveEvent(self, event):
        """ If minimum distance from mousePressEvent is reached initiates dragging.
        """
        #logging.debug(self.__class__.__name__ +": mouseMoveEvent()")
        if self._dragablePort and self._startDragPosition and bool(
                event.buttons() & Qt.LeftButton):
            if not self._aimConnection and (
                    event.pos() - self._startDragPosition
            ).manhattanLength() >= QApplication.startDragDistance():
                self._aimConnection = PointToPointConnection(
                    self.moduleParent(), self.connectionPoint(),
                    self.mapTo(self.moduleParent(), event.pos()))
                self._aimConnection.setSourceDirection(
                    self.CONNECTION_DIRECTION)
                self.connect(self._aimConnection, SIGNAL("connectionDeleted"),
                             self.resetAimConnection)

                if self.CONNECTION_DIRECTION == PointToPointConnection.ConnectionDirection.RIGHT:
                    self._aimConnection.setTargetDirection(
                        PointToPointConnection.ConnectionDirection.LEFT)
                elif self.CONNECTION_DIRECTION == PointToPointConnection.ConnectionDirection.LEFT:
                    self._aimConnection.setTargetDirection(
                        PointToPointConnection.ConnectionDirection.RIGHT)

                self._aimConnection.show()
            elif self._aimConnection:
                self._aimConnection.updateTargetPoint(
                    self.mapTo(self.moduleParent(), event.pos()))
        VispaWidget.mouseMoveEvent(self, event)