Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:21:04+00:00 2026-05-26T13:21:04+00:00

I have a Qt desktop application that works on Linux and Windows. At some

  • 0

I have a Qt desktop application that works on Linux and Windows. At some point I’m hoping to port it to MacOS X and other *nix systems too.

My problem is that, a part of the application has a functionality that allows users to drag and drop files into, and out from an archive. The UI is kinda like that of WinZip or similar GUI based archivers. But Qt’s drag and drop system wants the data to be prepared when the user starts dragging files from the archive.

What I currently do is, extract the dragged files to a temporary location, and supply those file names as data. But it’s undesirable because extracting deep directory trees take a good amount of time, and it causes the GUI to freeze during that time. It would be nice if I could do that operation when the user decides to drop the files, not when he/she starts to drag. Unfortunately Qt docs don’t say anything about this.

I know how to achieve this using Windows API, and I’m pretty sure that most systems have a way to do that too. But I want to avoid writing platform specific code as much as possible.

Is there a Qt way to achieve that? Am I missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:21:05+00:00Added an answer on May 26, 2026 at 1:21 pm

    I may be misunderstanding, but I think what you want to do is supply enough information in a QMimeData for the QDrag you create that you can find the files in the archive after the user drops it without having to extract them first. So, if your code on the drop end doesn’t know which archive the files have come from, you need to supply the path to the archive in your mime data, too.

    The drag starts as a message:
    “I’m dragging Archive1:FileA, Archive1:FileB” but no file extraction.

    It ends on the other end by interpreting the message and then extracting the files. I’d probably set up some kind of simple ICD for both sides of the message transfer. If you can only drag from one archive at a time, maybe a string list with the first element being the archive and following ones being the files:

    QStringList list;
    list << archivePath;
    list << fileName1;
    list << fileName2;
    
    QByteArray ba;
    QDataStream stream(&ba);
    stream << list;
    
    QMimeData* mime = new QMimeData;
    mime->setData("yourType", ba);
    

    I hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Windows desktop application written in Delphi that works fine on Windows
I have a simple Desktop Facebook application that allows the user to retrieve some
I have a Windows.Forms based .NET desktop application that stores privileged information in a
I have an application that works like a virtual desktop, with a toolbar with
I have Java desktop application that works with CSV files. And i want add
Our desktop application needs to run on Mac, Windows and Linux. That's why we
We have built an desktop(windows) application that needs SQL Server to store the data.
i have a WPF application that sits on top of all other windows. 99%
I have an application that works like a virtual desktop (icons in a horizontal
I have an application that works like a virtual desktop (icons in a horizontal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.