Drag and Drop .png file into MS Word fails



  • There is an issue with QT5 Drag and drop: when .png file is dropped into MS Word 2013, the path to the file is displayed instead of image, but it works correctly when dropping the into a folder. Source code has the following structure:

    qMimeData->setImageData(QImage(filePath));
    qUrls.push_back(QUrl("file:///" + filePath));
    qMimeData->setUrls(qUrls);
    QDrag* qDrag = new QDrag(qWidget);
    qDrag->setMimeData(qMimeData);
    qDrag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);

    What can be the cause of the issue?


  • Lifetime Qt Champion

    Hi,

    What happens if you don't call setUrls ?



  • Drag and Drop fails when file is dropped into a folder, but works with MS Word.


  • Moderators

    IIRC there is a convention that first added mime types have higher priority than later added ones.
    If Word doesn't follow this convention and decides to take another mime-type there is nothing you can do.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.