Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Drag and Drop .png file into MS Word fails

Drag and Drop .png file into MS Word fails

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arus1
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What happens if you don't call setUrls ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Arus1
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          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.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved