Q:

How to set the position of thumbnail for QDrag in a QFrame?

In my QFrame object, I am trying to achieve the effect where on mouse-down and mouse-move, a thumbnail follows the position of the cursor. I managed to achieve this. However, the thumbnail have some sort of an animation where it will 'fly in' from the 0,0 of the QFrame object towards the position of where the cursor is and back to 0,0 on mouse-release.
It looks something like that:

import sys
from PyQt5.QtWidgets import QApplication, QFrame
from PyQt5.QtCore import Qt, QMimeData
from PyQt5.QtGui import QDrag, QPixmap

class Example(QFrame):

    def __init__(self):
        super().__init__()
        self.resize(500, 500)

    def mouseMoveEvent(self, e):
        mimeData = QMimeData()
        drag = QDrag(self)
        thumbnail = QPixmap('test.png').scaled(100, 100, Qt.KeepAspectRatio)
        drag.setPixmap(thumbnail)
        drag.setMimeData(mimeData)
        drag.setHotSpot(e.pos())
        drag.exec_(Qt.MoveAction)

if __name__ == '__main__':    
    app = QApplication(sys.argv)
    ex = Example()
    ex.show()
    app.exec_()

What should be added/changed such that the thumbnail appears directly at the position of the cursor instead of 'flying in' and 'flying out'?

A:

Try it:
import sys
from PyQt5.QtWidgets import QApplication, QFrame, QLabel
from PyQt5.QtCore import Qt, QMimeData
from PyQt5.QtGui import QDrag, QPixmap

class Example(QFrame): 
    def __init__(self):
        super().__init__()
        self.resize(500, 500)
        self.label = QLabel(self)     # +++
        self.label.resize(100, 100)
        self.setAcceptDrops(True)     # +++

    def mouseMoveEvent(self, e):
        mimeData = QMimeData()
        drag     = QDrag(self)
        self.thumbnail = QPixmap('E:/_Qt/img/qt-logo.png').scaled(100, 100, Qt.KeepAspectRatio)
        drag.setPixmap(self.thumbnail)
        drag.setMimeData(mimeData)
#        drag.setHotSpot(e.pos())  
        drag.exec_(Qt.MoveAction) 

    def dropEvent(self, e):           # +++
        self.label.setPixmap(self.thumbnail)
        self.label.move(e.pos())

    def dragEnterEvent(self, e):      # +++
        if e.mimeData():
            e.acceptProposedAction()

if __name__ == '__main__':    
    app = QApplication(sys.argv)
    ex = Example()
    ex.show()
    app.exec_()

