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. Drop docx files in Qt on Windows
Qt 6.11 is out! See what's new in the release blog

Drop docx files in Qt on Windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 955 Views
  • 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.
  • denix56D Offline
    denix56D Offline
    denix56
    wrote on last edited by denix56
    #1

    I am trying to make my program get documents like docx, pptx etc when i drop those files in the widget. I need to unpack those files(because docx is zip format). I dont know how to get path to source file for 7z, so i have decided to copy received data to temporary file. But i get empty output file. What is wrong?

    void DragnDropWidget::dropEvent(QDropEvent *event)
    {
        QTemporaryFile docFile("C:/Users/Denis/Documents/Document_XXXXXX.docx");
        docFile.setAutoRemove(false);
        docFile.open();
        docFile.write(event->mimeData()->data("application/x-qt-windows-mime;"
                                                  "value=\"FileContents\""));
        event->acceptProposedAction();
        docFile.close();
    }
    
    raven-worxR 1 Reply Last reply
    0
    • denix56D denix56

      I am trying to make my program get documents like docx, pptx etc when i drop those files in the widget. I need to unpack those files(because docx is zip format). I dont know how to get path to source file for 7z, so i have decided to copy received data to temporary file. But i get empty output file. What is wrong?

      void DragnDropWidget::dropEvent(QDropEvent *event)
      {
          QTemporaryFile docFile("C:/Users/Denis/Documents/Document_XXXXXX.docx");
          docFile.setAutoRemove(false);
          docFile.open();
          docFile.write(event->mimeData()->data("application/x-qt-windows-mime;"
                                                    "value=\"FileContents\""));
          event->acceptProposedAction();
          docFile.close();
      }
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @denix56
      what does open() return?
      Is the data returned from the mimeData() valid?

      --- 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