def do_drag(self, widget):
        """ Perform the drag operation for the widget.
        
        Parameters
        ----------
        widget: QWidget
            A reference to the viewport widget.

        """
        drag_data = self.declaration.drag_start()
        if drag_data is None:
            return
        #widget = self.widget
        qdrag = QDrag(widget)
        qdrag.setMimeData(drag_data.mime_data.q_data())
        if drag_data.image is not None:
            qimg = get_cached_qimage(drag_data.image)
            qdrag.setPixmap(QPixmap.fromImage(qimg))
        #else:
            #if __version_info__ < (5, ):
                #qdrag.setPixmap(QPixmap.grabWidget(self.widget))
            #else:
                #qdrag.setPixmap(widget.grab())
        if drag_data.hotspot:
            qdrag.setHotSpot(QPoint(*drag_data.hotspot))
        else:
            cursor_position = widget.mapFromGlobal(QCursor.pos())
            qdrag.setHotSpot(cursor_position)
        default = Qt.DropAction(drag_data.default_drop_action)
        supported = Qt.DropActions(drag_data.supported_actions)
        qresult = qdrag.exec_(supported, default)
        self.declaration.drag_end(drag_data, DropAction(int(qresult)))
def do_drag ( self , widget ) : drag_data = self . declaration . drag_start ( ) if drag_data is None : return qdrag = QDrag ( widget ) qdrag . setMimeData ( drag_data . mime_data . q_data ( ) ) if drag_data . image is not None : qimg = get_cached_qimage ( drag_data . image ) qdrag . setPixmap ( QPixmap . fromImage ( qimg ) ) if drag_data . hotspot : qdrag . setHotSpot ( QPoint ( * drag_data . hotspot ) ) else : cursor_position = widget . mapFromGlobal ( QCursor . pos ( ) ) qdrag . setHotSpot ( cursor_position ) default = Qt . DropAction ( drag_data . default_drop_action ) supported = Qt . DropActions ( drag_data . supported_actions ) qresult = qdrag . exec_ ( supported , default ) self . declaration . drag_end ( drag_data , DropAction ( int ( qresult ) ) )
Perform the drag operation for the widget.
        
        Parameters
        ----------
        widget: QWidget
            A reference to the viewport widget.