Determines if a drag is taking place, and initiates it

def mouseMoveEvent(self, event):
        """Determines if a drag is taking place, and initiates it"""
        if (event.pos() - self.dragStartPosition).manhattanLength() < 10:
            return
        QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ClosedHandCursor))
        factory = self.factoryclass()

        mimeData = QtCore.QMimeData()
        try:
            mimeData.setData("application/x-protocol", factory.serialize())
        except:
            mimeData.setData("application/x-protocol", cPickle.dumps(factory))

        drag = QtGui.QDrag(self)
        drag.setMimeData(mimeData)

        pixmap = QtGui.QPixmap()
        pixmap = pixmap.grabWidget(self, self.frameRect())

        # below makes the pixmap half transparent
        # painter = QtGui.QPainter(pixmap)
        # painter.setCompositionMode(painter.CompositionMode_DestinationIn)
        # painter.fillRect(pixmap.rect(), QtGui.QColor(0, 0, 0, 127))
        # painter.end()

        drag.setPixmap(pixmap)

        drag.setHotSpot(QtCore.QPoint(pixmap.width()/2, pixmap.height()/2))
        drag.setPixmap(pixmap)

        self.dragActive.emit(True)
        result = drag.exec_(QtCore.Qt.MoveAction)

        QtGui.QApplication.restoreOverrideCursor()