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

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

问题描述

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



我打算通过以下步骤实现:


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

  2. 子类QMimeData类中,并覆盖retrieveData函数,正如此线程建议其中 [done]

  3. 只需完成拖放过程,然后找到删除的目标路径,如C:\somefolder\subfolder,然后下载所有文件,工作完成。但是我找不到任何地方得到丢弃的destionation路径,甚至没有处理dragEnter \dragMove \\\\\,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, dragLeave\drop事件。我也做了大量的谷歌搜索,发现一些类似的问题,但从来没有任何坚实的答案。



    请详细说明一下。这个解决方案是否甚至可以用QT来做?

    解决方案

    对于任何正在寻找这个目标的人,我可能会找到一个答案,但这并不容易,而且依赖平台。



    在大量(字面上)搜索之后,我在 FileZilla的源代码,原来是为了应对这种情况,你需要:


    1. 你需要一个shell扩展来监视(或无论如何)拖动过程

    2. 在鼠标丢弃时启动正常拖放

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

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

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



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


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

    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.

    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.

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

    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.

    for technical details, plz visit FileZilla official website

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

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

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