Drag & drop from/to desktop or folder in Windows or Linux
Hello, good afternoon,
(sorry for my English of bing translator)
I'm starting to migrate to Qt from Borland C ++ Builder, the last version I used is the XE, and I regret having taken so much time to migrate, Qt seems a lot simpler and faster to work that BCB.
Like all beginner in this IDE and the Qt libraries, I am with some problems for which I ask to help me.
I have an application with a QTreeWidget and a QListWidget, and each widget must be able to accept lists of files dragged from a Windows folder (desktop as folder or any other folder) or Linux and should also be able to drag lists of items and drop them into a folder.
In BCB (Windows) I did it this way:
On the header of the form's class, he placed these "capture" in the public section:
MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, WmDropFiles)
END_MESSAGE_MAP( TForm )
and I implemented them as well:
void __fastcall TfrmBandeja::WmDropFiles(TWMDropFiles& Message)
HDROP hDrop = (HDROP)Message.Drop;
int numFiles = DragQueryFile(hDrop, -1, NULL, NULL);
TStringList* lst = new TStringList;
for (int i=0;i < numFiles;i++)
DragQueryFile(hDrop, i, buff, sizeof(buff));
// process the file in 'buff'
lst->Add( buff );
expandirDirectorios( lst );
FEvArchivosIngresados( (TObject*)this, (TStringList*)lst ); // disparador del evento
I use Qt compiled with VC2010, then I guess that, in Windows not must be complicated to implement it. By the side of Linux, if I drag a file from or to the desktop, will depend on the desktop that I use, but if I drag a folder or from, I guess that the implementation should be quite specific Qt.
If you would like I can implement the capture of these events in Qt?
As I drag the Widget items (which are files) and drop them into a folder?
Thank you very much from now with all help or guide that I can give.
[[merged two identical posts, Tobias]]
Sorry for asking a question about a fully documented topic.
I assumed that the documented Drag and Drop was for operations between widgets of the same application. They are remnants of BCB.