The interesting part here is the QMimeData::retrieveData() overload. This method gets called when a drop happens.
So when a drop to the filesystem happens the mimedata requests the data and calls retrieveData(). In there you write your pixmap data to a temporary image file. For that you can use QTemporaryFile class for example. Write the data to the temporary file and return the url to the file. Mime-Type: "text/uri-list"
Analog for the pixmap image. Simply return the QPixmap. Mime-Type: "image/png"
Actually it could also be necessary to return the PNG binary data. I am not sure. This can be done like this:
This issue is now resolved. It turned out to be a problem in the model: I forgot to tell the root (invalid parent) to accept drops too. This is done in the QAbstractItemModel::flags() implementation.
The incorrect version was: