问题
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:
- init the drag event, and save the selected files' path on the server [done]
- subclass QMimeData class, and overwrite retrieveData function just as this thread suggests here [done]
- 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 ?
回答1:
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:
- you need a shell extension to monitor (or whatever) the drag process
- start a normal drag and drop
- when mouse is dropped, just do nothing, let the whole drag and drop process finish
- 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!
来源:https://stackoverflow.com/questions/38804272/qt-drag-and-drop-to-windows-explorer-how-do-i-know-the-dropped-destination-path