Qt拖放到Windows资源管理器:如何知道丢弃的目标路径 [英] Qt Drag and Drop to windows explorer: How do I know the dropped destination path

查看:297
本文介绍了Qt拖放到Windows资源管理器:如何知道丢弃的目标路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是显示在线文件的列表视图,就像一个FTP客户端列出FTP服务器上的所有文件,一个可以拖动任何行或行到任何本地文件夹来保存拖动的文件在那里。

What I'm trying to do is to display a listview of online files, just like an FTP client lists all the files on the FTP server, and one can drag any row or rows to any local folder to save the dragged files right there.

我计划通过以下步骤实现这一点:

I'm planning to implement this through the follwing steps:


  1. init拖动事件,并将所选文件的路径保存在服务器上[done]

  2. 子类QMimeData类,并覆盖retrieveData函数,正如此线程建议在这里 [done] / li>
  3. 只需完成拖放过程,然后找到丢失的目标路径,说出C:\somefolder\subfolder,然后下载所有文件完成。 [not done]

  1. init the drag event, and save the selected files' path on the server [done]
  2. subclass QMimeData class, and overwrite retrieveData function just as this thread suggests here [done]
  3. Just finish the drag and drop process, and find the dropped destination path, say C:\somefolder\subfolder, then download all the files there, job done. 【not done】

但我找不到任何地方获取丢弃的destionation路径,甚至无法通过处理dragEnter\dragMove\ dragLeave \drop事件。我也做了大量的谷歌搜索,发现一些类似的问题,但从来没有任何坚实的答案。

But I could not find anywhere to get the dropped destionation path, not even by processing dragEnter\dragMove\dragLeave\drop events. I've also done tons of google search, found some similar questions but never any solid answer.

请阐明这一点。这个解决方案甚至可以用QT吗?

Please shed some light on this. Is this solutuion even doable with QT ? How should I get the destination path or is there any other way to achieve this goal ?

推荐答案

对于任何寻找这个目标的人来说,我可能会找到一个答案,但它不容易,可能是平台依赖。

For anyone who's searching for this, I might find an answer, but it ain't easy and could be platform dependent.

经过多次(字面上)搜索后,我在中找到了一个解决方案FileZilla的源代码,原来是为了应付这种情况,你需要:

After tons of (literally) search, I found a solution in FileZilla's source code, turns out to cope with such situatuation, you need:


  1. 你需要一个shell扩展来监视

  2. 当鼠标被放置时,开始正常的拖放操作

  3. ,只是不做任何事情,让整个拖放过程完成

  4. 通过shell扩展,您可以获取实际的目标路径,只需下载您的文件。

  1. you need a shell extension to monitor (or whatever) the drag process
  2. start a normal drag and drop
  3. when mouse is dropped, just do nothing, let the whole drag and drop process finish
  4. through the shell extension, you can get the actual destination path, and just download your files there.

有关技术细节,请访问 FileZilla官方网站

for technical details, plz visit FileZilla official website

我认为这只适用于Windows,如果任何人得到其他平台的答案,请让我知道!

I think this is for windows only, if anyone get the answer for other platforms, please let me know!

这篇关于Qt拖放到Windows资源管理器:如何知道丢弃的目标路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆